direct-io.hg

changeset 3282:7a1b61b77a0b

bitkeeper revision 1.1159.187.67 (41bf7064JLmIpzjd7PLO18qfijLBrA)

Avoid backtraces from Python console client.
author kaf24@scramble.cl.cam.ac.uk
date Tue Dec 14 22:59:48 2004 +0000 (2004-12-14)
parents 12cf2ba64202
children 8724fc0ba838 361671727b96
files tools/misc/xencons tools/python/xen/util/console_client.py
line diff
     1.1 --- a/tools/misc/xencons	Tue Dec 14 16:38:48 2004 +0000
     1.2 +++ b/tools/misc/xencons	Tue Dec 14 22:59:48 2004 +0000
     1.3 @@ -27,24 +27,33 @@ def __recv_from_sock(sock):
     1.4      while not stop:
     1.5          try:
     1.6              data = sock.recv(1024)
     1.7 +        except socket.error, error:
     1.8 +            if error[0] != errno.EINTR:
     1.9 +                raise
    1.10 +        try:
    1.11              os.write(1, data)
    1.12 -        except socket.error, error:
    1.13 +        except os.error, error:
    1.14              if error[0] != errno.EINTR:
    1.15                  raise
    1.16      os.wait()
    1.17  
    1.18  def __send_to_sock(sock):
    1.19      while 1:
    1.20 -        data = os.read(0,1024)
    1.21 -        if ord(data[0]) == ord(']')-64:
    1.22 -            break
    1.23          try:
    1.24 -            sock.send(data)
    1.25 -        except socket.error, error:
    1.26 -            if error[0] == errno.EPIPE:
    1.27 -                sys.exit(0)
    1.28 +            data = os.read(0,1024)
    1.29 +        except os.error, error:
    1.30              if error[0] != errno.EINTR:
    1.31                  raise
    1.32 +        else:
    1.33 +            if ord(data[0]) == ord(']')-64:
    1.34 +                break
    1.35 +            try:
    1.36 +                sock.send(data)
    1.37 +            except socket.error, error:
    1.38 +                if error[0] == errno.EPIPE:
    1.39 +                    sys.exit(0)
    1.40 +                if error[0] != errno.EINTR:
    1.41 +                    raise
    1.42      sys.exit(0)
    1.43  
    1.44  def connect(host,port):
     2.1 --- a/tools/python/xen/util/console_client.py	Tue Dec 14 16:38:48 2004 +0000
     2.2 +++ b/tools/python/xen/util/console_client.py	Tue Dec 14 22:59:48 2004 +0000
     2.3 @@ -27,24 +27,33 @@ def __recv_from_sock(sock):
     2.4      while not stop:
     2.5          try:
     2.6              data = sock.recv(1024)
     2.7 +        except socket.error, error:
     2.8 +            if error[0] != errno.EINTR:
     2.9 +                raise
    2.10 +        try:
    2.11              os.write(1, data)
    2.12 -        except socket.error, error:
    2.13 +        except os.error, error:
    2.14              if error[0] != errno.EINTR:
    2.15                  raise
    2.16      os.wait()
    2.17  
    2.18  def __send_to_sock(sock):
    2.19      while 1:
    2.20 -        data = os.read(0,1024)
    2.21 -        if ord(data[0]) == ord(']')-64:
    2.22 -            break
    2.23          try:
    2.24 -            sock.send(data)
    2.25 -        except socket.error, error:
    2.26 -            if error[0] == errno.EPIPE:
    2.27 -                sys.exit(0)
    2.28 +            data = os.read(0,1024)
    2.29 +        except os.error, error:
    2.30              if error[0] != errno.EINTR:
    2.31                  raise
    2.32 +        else:
    2.33 +            if ord(data[0]) == ord(']')-64:
    2.34 +                break
    2.35 +            try:
    2.36 +                sock.send(data)
    2.37 +            except socket.error, error:
    2.38 +                if error[0] == errno.EPIPE:
    2.39 +                    sys.exit(0)
    2.40 +                if error[0] != errno.EINTR:
    2.41 +                    raise
    2.42      sys.exit(0)
    2.43  
    2.44  def connect(host,port):