Hello i have such problem, i need to execute some command and wait for it's output, but before reading output i need to write \n
to pipe. This the unitest, so in some cases command witch i test don't answer and my testcase stopping at stdout.readline()
and waiting for smth. So my question is, is it possible to set something like timeout to reading line.
cmd = ['some', 'list', 'of', 'commands']
fp = subprocess.Popen(cmd, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
fp.stdin.write('\n')
fp.stdout.readline()
out, err = fp.communicate()