overlord: fix unittest
Fix unittest introduced by the file upload/download implementation.
BUG=none
TEST=`go/src/overlord/test/overlord_e2e_unittest.py`
Change-Id: I5995a103fbc6e8c3133c393455952f453e175d24
Reviewed-on: https://chromium-review.googlesource.com/291211
Reviewed-by: Chih-Yu Huang <akahuang@chromium.org>
Commit-Queue: Wei-Ning Huang <wnhuang@chromium.org>
Tested-by: Wei-Ning Huang <wnhuang@chromium.org>
diff --git a/py/tools/ghost.py b/py/tools/ghost.py
index 07bf93c..da72bd6 100755
--- a/py/tools/ghost.py
+++ b/py/tools/ghost.py
@@ -441,11 +441,6 @@
try:
while True:
rd, _, _ = select.select([p.stdout, p.stderr, self._sock], [], [])
- p.poll()
-
- if p.returncode != None:
- raise RuntimeError('process complete')
-
if p.stdout in rd:
self._sock.send(p.stdout.read(_BUFSIZE))
@@ -457,7 +452,11 @@
if len(ret) == 0:
raise RuntimeError('socket closed')
p.stdin.write(ret)
- except (OSError, socket.error, RuntimeError):
+
+ p.poll()
+ if p.returncode != None:
+ break
+ finally:
self._sock.close()
logging.info('SpawnShellServer: terminated')
sys.exit(0)