I am debugging a failure in code that is calling
std::process::Command::output and returns an OS error 2 (file not found). Sadly, the error doesn't tell me which file is not found, and that may be the most important thing.
The documentation at: https://doc.rust-lang.org/std/process/struct.Command.html#method.output isn't saying under which conditions that may happen.
So, when can
Command::output return "file not found"? Would it be something that'd be reasonable to document. The error condition is not self-evident to me, am I missing something?
Does it return an
Err case of
Result, or is the error in the
Output object itself? In the former case, it's likely the program you're trying to launch which is not found. In the latter case, does the command work from the shell, in the same working directory with the same arguments?
Command::output is documented to return
Result<Output>. Under which conditions does this return value match
Command::output does two things that can fail:
- Creates pipe(s)
- Starts the process
Creating a pipe should always succeed under normal circumstances. Starting a process can fail if the executable isn't found or you don't have permission to execute it.
This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.