From d417bbef952bfd213c99f73a706ec785720124a6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maty=C3=A1=C5=A1=20Racek?= Date: Sat, 31 Oct 2020 14:40:36 +0100 Subject: [PATCH 1/2] Add note to process::arg[s] that args shouldn't be escaped or quoted --- library/std/src/process.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/library/std/src/process.rs b/library/std/src/process.rs index a149946774404..ae4a077587565 100644 --- a/library/std/src/process.rs +++ b/library/std/src/process.rs @@ -557,6 +557,9 @@ impl Command { /// /// [`args`]: Command::args /// + /// Note that the argument is passed to the program directly as is, so you shouldn't wrap it in quotes + /// or escape special characters the same way you would do that when running the program from terminal. + /// /// # Examples /// /// Basic usage: @@ -582,6 +585,9 @@ impl Command { /// /// [`arg`]: Command::arg /// + /// Note that each argument is passed to the program directly as is, so you shouldn't wrap it in quotes + /// or escape special characters the same way you would do that when running the program from terminal directly. + /// /// # Examples /// /// Basic usage: From db416b232c1b7ebeb250e19cbca7b52ab81bc3f3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Maty=C3=A1=C5=A1=20Racek?= Date: Sat, 31 Oct 2020 17:28:44 +0100 Subject: [PATCH 2/2] Apply suggestions from code review Co-authored-by: Mara Bos --- library/std/src/process.rs | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/library/std/src/process.rs b/library/std/src/process.rs index ae4a077587565..2c7ed4614bce9 100644 --- a/library/std/src/process.rs +++ b/library/std/src/process.rs @@ -557,8 +557,10 @@ impl Command { /// /// [`args`]: Command::args /// - /// Note that the argument is passed to the program directly as is, so you shouldn't wrap it in quotes - /// or escape special characters the same way you would do that when running the program from terminal. + /// Note that the argument is not passed through a shell, but given + /// literally to the program. This means that shell syntax like quotes, + /// escaped characters, word splitting, glob patterns, substitution, etc. + /// have no effect. /// /// # Examples /// @@ -585,8 +587,10 @@ impl Command { /// /// [`arg`]: Command::arg /// - /// Note that each argument is passed to the program directly as is, so you shouldn't wrap it in quotes - /// or escape special characters the same way you would do that when running the program from terminal directly. + /// Note that the arguments are not passed through a shell, but given + /// literally to the program. This means that shell syntax like quotes, + /// escaped characters, word splitting, glob patterns, substitution, etc. + /// have no effect. /// /// # Examples ///