New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Reading from a killed shell script with popen* under linux #41943
Comments
These are problems I've run into under linux (Mandrake If you run this: import os
pout = os.popen("/bin/sleep 999")
print pout.read()
print pout.close() and kill the "sleep", you get the desired behaviour: #!/bin/sh and run the script through popen (or one of the popen* import os
pout = os.popen("/tmp/test.sh")
print pout.read()
print pout.close() then kill the sh running "test.sh", the read never import popen2
sub = popen2.Popen3("/tmp/test.sh")
print sub.wait()
print sub.fromchild.read() this time the wait correctly returns the signal that As an added oddity, if you run the popen command from I have a final suggestion: if you try reading the import os
pout = os.popen("for i in $(seq 1 10); do echo $i;
sleep 1; done")
for l in pout: print l, it waits for the subprocess to complete before going sub = popen2.Popen3("for i in $(seq 1 10); do echo $i;
sleep 1; done")
while (-1 == sub.poll()): print sub.fromchild.readline() I don't know if this last behaviour can be fixed or not |
Logged In: YES Oops, just saw the report bpo-1180160. I missed it because I |
Logged In: YES The report bpo-1180160 was only loosely related to the above NB : This bug is very incapacitating for me since I can't |
Logged In: YES This is not a bug after all... When you run a command through a shell script, kill the Oh well, I thinks I'll stop talking to myself, now. I must |
Note: these values reflect the state of the issue at the time it was migrated and might not reflect the current state.
Show more details
GitHub fields:
bugs.python.org fields:
The text was updated successfully, but these errors were encountered: