1 file changed +16
-0
lines changed Original file line number Diff line number Diff line change @@ -606,6 +606,22 @@ impl Command {
606
606
/// but this has some implementation limitations on Windows
607
607
/// (see issue #37519).
608
608
///
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
+ ///
609
625
/// # Platform-specific behavior
610
626
///
611
627
/// Note on Windows: For executable files with the .exe extension,
0 commit comments