API Reference

execute.both(command, cwd=None)

Execute the command specified in a sub-process.

This command must take no input. A 2-tuple will be returned. Any output to either the standard or error streams will be collected and returned as the first element of the tuple.The exit code set by the command will be returned as the second element of the tuple.

Parameters:
  • command – A string containing the command to be executed.
  • cwd – An optional current working directory in which to run the command. If not specified, the current working directory will be left as-is.
Returns:

The output and exit code of the command that was run.

execute.returncode(command, cwd=None)

Execute the command specified in a sub-process.

This command must take no input. The exit code set by the command will be returned. Any output from the command to either the standard or error streams will be discarded.

Parameters:
  • command – A string containing the command to be executed.
  • cwd – An optional current working directory in which to run the command. If not specified, the current working directory will be left as-is.
Returns:

The exit code set by the command that was run.

execute.simple(command, cwd=None)

Execute the command specified in a sub-process.

This command must take no input. Any output to either the standard or error streams will be collected and returned as a string.

Parameters:
  • command – A string containing the command to be executed.
  • cwd – An optional current working directory in which to run the command. If not specified, the current working directory will be left as-is.
Returns:

A string containing anything written to the standard or error streams by the command as it runs.

Previous topic

Using Execute

Next topic

Development

This Page