JasperVanDenBosch / fexpect

extension for fabric to handle prompts through pexpect
http://ilogue.com/jasper/blog/fexpect--dealing-with-prompts-in-fabric-with-pexpect/
BSD 2-Clause "Simplified" License
44 stars 13 forks source link

fexpect run() supresses non-zero return codes #28

Open jianga opened 8 years ago

jianga commented 8 years ago

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.

JasperVanDenBosch commented 8 years ago

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.