fexpect
fexpect copied to clipboard
fexpect run() supresses non-zero return codes
I have a script that includes this:
with expecting(prompts):
run("python -c 'raise Exception()'")
# other steps
When I run the script, the exception's non-zero exit code is suppressed and keeps going to the other steps. When I run the script without expecting(prompts), the code exits like this, which is what I'd like:
Fatal error: run() received nonzero return code 1 while executing!
Requested: python -c 'raise Exception()'
Executed: /bin/bash -l -c "python -c 'raise Exception()'"
Aborting.
I'd like the script to exit when errors occur instead of failing silently and continuing.
Sorry @jianga I don't have time to implement this right now. If anyone else feels like it, feel free to open a PR.
In fact I'm not even sure this can be done with pexpect.