Here's my subprocess call:
def myrun(cmd):
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
stdout = []
while True:
line = p.stdout.readline()
stdout.append(line)
print line,
if line == '' and p.poll() != None:
break
return ''.join(stdout)
When I run the 'cmd' normally, the output is usually something like:
some text...
some more text...
Do you want to continue [yes/no]? : y
more output...
But running the same 'cmd' with subprocess as shown above, my output is like this:
Do you want to continue [yes/no]? : y
some text...
some more text...
more output...
How do I fix this?