diff --git a/gsh/stdin.py b/gsh/stdin.py
index <HASH>..<HASH> 100644
--- a/gsh/stdin.py
+++ b/gsh/stdin.py
@@ -162,7 +162,8 @@ def write_main_socket(c):
         try:
             the_stdin_thread.socket_write.recv(1)
         except socket.error, e:
-            assert e[0] == errno.EINTR
+            if e[0] != errno.EINTR:
+                raise
         else:
             break
 
diff --git a/tests/gsh_tests.py b/tests/gsh_tests.py
index <HASH>..<HASH> 100755
--- a/tests/gsh_tests.py
+++ b/tests/gsh_tests.py
@@ -108,7 +108,8 @@ def main():
     try:
         shutil.rmtree(PID_DIR)
     except OSError, e:
-        assert e.errno == errno.ENOENT
+        if e.errno != errno.ENOENT:
+            raise
     os.mkdir(PID_DIR)
     if args:
         import_specified_tests(args)
Don't lose the original stack trace