pub fn execute_command(
command_text: &str,
cwd: Option<&Path>,
) -> Result<ExitStatus>Expand description
Execute a command string through the shell.
Uses the SHELL environment variable (fallback /bin/sh) to run
the command via sh -c. Stdin, stdout, and stderr are inherited so
the user sees output in real-time and can interact with prompts.
If cwd is provided and the directory exists, the command runs in
that directory. If the directory doesn’t exist, a warning is printed
to stderr and the current directory is used instead.
§Errors
Returns an error if the shell process cannot be spawned or waited on.