Skip to content

Process properties

Process properties can be queried at any time and should reflect the current status of the process.

import time


With code:

from icommandlib import ICommand, UnexpectedExit
from commandlib import python
import time

process = ICommand(python("")).run()


The 'running' property will report whether the status is currently running or not.

assert process.running == True
assert process.running == False
  • When the code is run to completion.

Exit code

exit_code property will be None while the process is running, and contain the exit code once finished.

assert process.exit_code is None
assert process.exit_code == 0, process.exit_code
  • When the code is run to completion.

Process ID

pid property contains the pid of the process while the process is running, and None once it is finished.

If you try and get .pid after the process has finished of its own accord, without having explicitly waited for it, it will raise an UnexpectedExit exception.

assert is not None

    now_finished =
except UnexpectedExit:

assert is None,
  • When the code is run to completion.

Executable specification

Documentation automatically generated from process-properties.story storytests.