How can I get the exit code of subprocess.check_output?
I'm assuming the returncode should be 0 if a file is found matching my pattern and non-zero if no files are found matching the pattern?
If there is an exception, I'm recieving a non-zero returncode, as expected.
try:
output = subprocess.check_output(["staf", "server.com", "PROCESS", "START", "SHELL", "COMMAND", "ls *heapdump*", "WAIT", "RETURNSTDOUT", "STDERRTOSTDOUT"])
print result
except CalledProcessError as e:
print(e.returncode)
sys.exit(e.returncode)