msg = " rexec - host %s - command %s " % (host, " ".join(args))
log(msg, logging.DEBUG, out, err)
msg = " rexec - host %s - command %s " % (host, " ".join(args))
log(msg, logging.DEBUG, out, err)
-def _communicate(self, input, timeout=None, err_on_timeout=True):
+def _communicate(proc, input, timeout=None, err_on_timeout=True):
# Flush stdio buffer. This might block, if the user has
# been writing to .stdin in an uncontrolled fashion.
# Flush stdio buffer. This might block, if the user has
# been writing to .stdin in an uncontrolled fashion.
# When select has indicated that the file is writable,
# we can write up to PIPE_BUF bytes without risk
# blocking. POSIX defines PIPE_BUF >= 512
# When select has indicated that the file is writable,
# we can write up to PIPE_BUF bytes without risk
# blocking. POSIX defines PIPE_BUF >= 512
- bytes_written = os.write(self.stdin.fileno(), buffer(input, input_offset, 512))
+ bytes_written = os.write(proc.stdin.fileno(),
+ buffer(input, input_offset, 512))
- if self.stdout in rlist:
- data = os.read(self.stdout.fileno(), 1024)
+ if proc.stdout in rlist:
+ data = os.read(proc.stdout.fileno(), 1024)
- if self.stderr in rlist:
- data = os.read(self.stderr.fileno(), 1024)
+ if proc.stderr in rlist:
+ data = os.read(proc.stderr.fileno(), 1024)
# object do the translation: It is based on stdio, which is
# impossible to combine with select (unless forcing no
# buffering).
# object do the translation: It is based on stdio, which is
# impossible to combine with select (unless forcing no
# buffering).
raise RuntimeError, ("Operation timed out", errcode, stdout, stderr)
else:
if killed:
raise RuntimeError, ("Operation timed out", errcode, stdout, stderr)
else:
if killed: