Skip to content

Commit 63cfe66

Browse files
authored
Merge pull request #3347 from patrickbkr/problem-solving20
Document `:$win-verbatim-args` argument of `run()` and related functions
2 parents 470ed9c + 1d19613 commit 63cfe66

File tree

3 files changed

+21
-5
lines changed

3 files changed

+21
-5
lines changed

doc/Type/Proc.pod6

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,11 +170,17 @@ n block <unit> at /tmp/3169qXElwq line 1␤␤»
170170
171171
=head2 method spawn
172172
173-
method spawn(*@args ($, *@), :$cwd = $*CWD, Hash() :$env = %*ENV --> Bool:D)
173+
method spawn(*@args ($, *@), :$cwd = $*CWD, Hash() :$env = %*ENV, :$win-verbatim-args = False --> Bool:D)
174174
175175
Runs the C<Proc> object with the given command, argument list, working directory,
176176
and environment.
177177
178+
On Windows the flag C<$win-verbatim-args> disables all automatic quoting of
179+
process arguments. See L<this blog|https://docs.microsoft.com/en-us/archive/blogs/twistylittlepassagesallalike/everyone-quotes-command-line-arguments-the-wrong-way>
180+
for more information on windows command quoting. The flag is ignored on all
181+
other platforms. The flag was introduced in Rakudo version 2020.06 and is not
182+
present in older releases.
183+
178184
=head2 method shell
179185
180186
method shell($cmd, :$cwd = $*CWD, :$env --> Bool:D)

doc/Type/Proc/Async.pod6

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,10 @@ An example of piping several commands like C<echo "Hello, world" | cat -n>:
116116
117117
=head2 method new
118118
119-
multi method new(*@ ($path, *@args), :$w, :$enc, :$translate-nl --> Proc::Async:D)
120-
multi method new( :$path, :@args, :$w, :$enc, :$translate-nl --> Proc::Async:D)
119+
multi method new(*@ ($path, *@args), :$w, :$enc, :$translate-nl,
120+
:$win-verbatim-args = False --> Proc::Async:D)
121+
multi method new( :$path, :@args, :$w, :$enc, :$translate-nl,
122+
:$win-verbatim-args = False --> Proc::Async:D)
121123
122124
Creates a new C<Proc::Async> object with external program name or path
123125
C<$path> and the command line arguments C<@args>.
@@ -134,6 +136,12 @@ If C<:translate-nl> is set to C<True> (default value), OS-specific
134136
newline terminators (e.g. C<\r\n> on Windows) will be automatically
135137
translated to C<\n>.
136138
139+
On Windows the flag C<$win-verbatim-args> disables all automatic quoting of
140+
process arguments. See L<this blog|https://docs.microsoft.com/en-us/archive/blogs/twistylittlepassagesallalike/everyone-quotes-command-line-arguments-the-wrong-way>
141+
for more information on windows command quoting. The flag is ignored on all
142+
other platforms. The flag was introduced in Rakudo version 2020.06 and is not
143+
present in older releases.
144+
137145
=head2 method stdout
138146
139147
method stdout(Proc::Async:D: :$bin --> Supply:D)

doc/Type/independent-routines.pod6

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -496,7 +496,8 @@ sub run(
496496
Str:D :$enc = 'UTF-8',
497497
Str:D :$nl = "\n",
498498
:$cwd = $*CWD,
499-
Hash() :$env = %*ENV
499+
Hash() :$env = %*ENV,
500+
:$win-verbatim-args = False
500501
--> Proc:D)
501502
502503
Runs an external command I<without involving a shell> and returns a
@@ -554,7 +555,8 @@ These argument are quite flexible and admit, for instance, handles to
554555
redirect them. See L<Proc|/type/Proc> and
555556
L<Proc::Async|/type/Proc::Async> for more details.
556557
557-
See also L<C<new>|/type/Proc#method_new> for more examples.
558+
See also L<C<new>|/type/Proc#method_new> and L<C<spawn>|/type/Proc#method_spawn>
559+
for more examples and explanation of all arguments.
558560
559561
=head2 sub shell
560562

0 commit comments

Comments
 (0)