Skip to content

Commit 7f007f5

Browse files
committed
Document behaviour and caveats due to sunk unsuccessful Proc
1 parent bde27dc commit 7f007f5

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

doc/Type/Proc.pod6

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,11 @@ of a newline is.
7474
If C<$merge> is set to True, the standard output and error stream end up
7575
merged in C<$proc.out>.
7676
77+
=head2 method sink
78+
79+
When sunk, the C<Proc> object will throw L<X::Proc::Unsuccessful>
80+
if the process it run exited unsuccessfully.
81+
7782
=head2 method spawn
7883
7984
method spawn(Proc:D *@args ($, *@), :$cwd = $*CWD, Hash() :$env = %*ENV) returns Bool:D

doc/Type/Proc/Async.pod6

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -125,6 +125,17 @@ called before, an exception of L<type
125125
X::Proc::Async::AlreadyStarted|/type/X::Proc::Async::AlreadyStarted> is
126126
thrown.
127127
128+
Note: If you wish to C<await> the Promise and discard its result, using
129+
130+
try await $p.start;
131+
132+
B<will throw> if the program exited with non-zero status, as the C<Proc>
133+
returned as the result of the Promise throws when sunk and in this case it
134+
will get sunk outside the C<try>. To avoid that, sink it yourself I<inside> the
135+
C<try>:
136+
137+
try sink await $p.start;
138+
128139
=head2 method started
129140
130141
method started(Proc::Async:D:) returns Bool:D

0 commit comments

Comments
 (0)