fexpect icon indicating copy to clipboard operation
fexpect copied to clipboard

fexpect run() supresses non-zero return codes

Open jianga opened this issue 8 years ago • 1 comments

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.

jianga avatar Mar 11 '16 00:03 jianga

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.

JasperVanDenBosch avatar Mar 24 '16 01:03 JasperVanDenBosch