Running Commands

Python’s subprocess module allows interaction with the underlying shell. StagedScript.run() is a lightweight wrapper around subprocess.run(), which includes the following additional features:

  • Allows printing commands in --dry-run mode.

  • Saves the command to a list of commands executed.

  • Optionally prints the command before executing it.

  • Allows passing additional options to subprocess.run().