chiark / gitweb /
fishdescriptor: fix error handling
[chiark-utils.git] / fishdescriptor / py / fishdescriptor / fish.py
index a506938964f71671c757b57decdceacb9039151a..56a562db6ce9c94a400e5b60eb1c226c59d36a37 100644 (file)
@@ -13,6 +13,8 @@ def _shuffle_fd3():
     os.dup2(1,3)
     os.dup2(2,1)
 
+class Error(Exception): pass
+
 class Donor():
     def __init__(d, pid, debug=None):
         d.pid = pid
@@ -35,6 +37,7 @@ class Donor():
     def _eval_integer(d, expr):
         try:
             l = d._sp.stdout.readline()
+            if not len(l): raise Error('gdb process donor python repl quit')
             if l != b'!\n': raise RuntimeError("indonor said %s" % repr(l))
             d._sp.stdin.write(expr.encode('utf-8') + b'\n')
             d._sp.stdin.flush()