We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Command::new
1 parent 06194ca commit 9844d7fCopy full SHA for 9844d7f
library/std/src/process.rs
@@ -629,6 +629,16 @@ impl Command {
629
/// .spawn()
630
/// .expect("sh command failed to start");
631
/// ```
632
+ ///
633
+ /// # Caveats
634
635
+ /// [`Command::new`] is only intended to accept the path of the program. If you pass a program
636
+ /// path along with arguments like `Command::new("ls -l").spawn()`, it will try to search for
637
+ /// `ls -l` literally. The arguments need to be passed separately, such as via [`arg`] or
638
+ /// [`args`].
639
640
+ /// [`arg`]: Self::arg
641
+ /// [`args`]: Self::args
642
#[stable(feature = "process", since = "1.0.0")]
643
pub fn new<S: AsRef<OsStr>>(program: S) -> Command {
644
Command { inner: imp::Command::new(program.as_ref()) }
0 commit comments