Getting the exit code of a subprocess
Jason
electron at emypeople.net
Wed Dec 15 22:38:48 EST 2021
Hello,
How can I find out the exit code of a process when using the subprocess module? I am passing an email message to a shell script and I need to know whether the shell script threw an error.
Here is my code:
p = Popen(cmd, stdout=None, stdin=PIPE, stderr=None)
p.communicate(input=msg)
I tried something like this:
e_stat = p.communicate(input=msg)
but the value of e_stat is always '(None, None)'
--
Thanks & best regards,
Jason Rissler
More information about the Python-list
mailing list