Wait until successful exit
Wait until exit with status code 0.
import sys sys.stdout.write("hello") sys.stdout.flush()
import sys sys.stderr.write("something went wrong!") sys.stderr.flush() sys.exit(255)
from icommandlib import ICommand from commandlib import python
process = ICommand(python("successful_exit.py")).run() process.wait_for_successful_exit() with open("finalscreenshot.txt", "w") as handle: handle.write(process.screenshot()) assert process.exit_code == 0, process.exit_code
- When the code is run to completion.
The file contents of
finalscreenshot.txt will then be:
Will raise an exception of type
Process exited with non-zero exit code 255. Output: something went wrong!
Documentation automatically generated from wait-until-successful-exit.story storytests.