How to run executables¶
The Application.subprocess
property is the preferred way to run and capture the output of external commands.
import click
from dda.cli.base import dynamic_command, pass_app
@dynamic_command()
@pass_app
def cmd(app: Application) -> None:
# call methods on app.subprocess
Running commands¶
The SubprocessRunner.run
method is used to run a command and wait for it to complete.
Capturing output¶
The SubprocessRunner.capture
method is used to run a command and capture its output.
Running a final command¶
The SubprocessRunner.exit_with
method is used to run a command and exit the current process with the command's exit code.