Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Skip blank lines when expecting echoed return code

  • Loading branch information...
commit 012a7f06ab722707ece197867d73ec55b41359d2 1 parent ad675e5
@mwilliamson authored
Showing with 9 additions and 2 deletions.
  1. +9 −2 spur/ssh.py
View
11 spur/ssh.py
@@ -87,9 +87,9 @@ def spawn(self, command, *args, **kwargs):
process_stdout = channel.makefile('rb')
if store_pid:
- pid = int(process_stdout.readline().strip())
+ pid = _read_int_line(process_stdout)
- which_return_code = int(process_stdout.readline().strip())
+ which_return_code = _read_int_line(process_stdout)
if which_return_code != 0:
raise NoSuchCommandError(command[0])
@@ -216,6 +216,13 @@ def _connection_error(self, error):
return connection_error
+def _read_int_line(output_file):
+ while True:
+ line = output_file.readline().strip()
+ if line:
+ return int(line)
+
+
class SftpFile(object):
def __init__(self, sftp, file):
self._sftp = sftp
Please sign in to comment.
Something went wrong with that request. Please try again.