Note
This page is a reference documentation. It only explains the function signature, and not how to use it. Please refer to the user guide for the big picture.
brainprep.wrappers.run_command¶
- brainprep.wrappers.run_command(cmd)[source]¶
Execute a command-line instruction and return its output.
This function first verifies that the command exists on the system, then executes it while capturing both standard output and standard error. If the command exits with a non-zero return code, the captured output is displayed and a RuntimeError is raised.
- Parameters:
- cmdlist[str]
The command to execute, provided as a list where the first element is the executable name and the remaining elements are arguments.
- Returns:
- stdoutstr
The decoded standard output produced by the command.
- Raises:
- RuntimeError
If the command is not installed or if execution returns a non-zero exit code.