self.s = s
(f_in, f_out, f_err) = (s.stdin, s.stdout, s.stderr)
lout, lin, lerr = select([f_out], [], [f_err], timeout)
if len(lin) == 0 and len(lout) == 0 and len(lerr) == 0:
# Reached a timeout! Nuke process so it does not hang.
self.s = s
(f_in, f_out, f_err) = (s.stdin, s.stdout, s.stderr)
lout, lin, lerr = select([f_out], [], [f_err], timeout)
if len(lin) == 0 and len(lout) == 0 and len(lerr) == 0:
# Reached a timeout! Nuke process so it does not hang.