File tree Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Expand file tree Collapse file tree 1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -606,6 +606,22 @@ impl Command {
606606 /// but this has some implementation limitations on Windows
607607 /// (see issue #37519).
608608 ///
609+ /// [`Command::new`] is only intended to accept the path of the program. If you pass a program
610+ /// path along with arguments such as `ls -l` for the program `ls` and argument `-l`, it will
611+ /// try to search for `ls -l` literally.
612+ ///
613+ /// ```no_run (example demonstrating incorrect usage)
614+ /// use std::process::Command;
615+ ///
616+ /// // Does not launch `ls`, will try to launch a program named `ls -l` literally.
617+ /// Command::new("ls -l")
618+ /// .spawn()
619+ /// .unwrap();
620+ /// ```
621+ ///
622+ /// The arguments need to be passed separately, such as via [`Command::arg`] or
623+ /// [`Command::args`].
624+ ///
609625 /// # Platform-specific behavior
610626 ///
611627 /// Note on Windows: For executable files with the .exe extension,
You can’t perform that action at this time.
0 commit comments