-
-
Save zoffixznet/782784e1ae1cce95fd8e506377b08952 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
diff --git a/src/core/Proc.pm6 b/src/core/Proc.pm6 | |
index 5cd1a1b..14da2d2 100644 | |
--- a/src/core/Proc.pm6 | |
+++ b/src/core/Proc.pm6 | |
@@ -49,16 +49,24 @@ my class Proc { | |
} | |
if $merge { | |
- my $chan = Channel.new; | |
- $!out = IO::Pipe.new(:proc(self), :$chomp, :$enc, :$bin, nl-in => $nl, | |
- :on-read({ (try $chan.receive) // buf8 }), | |
- :on-close({ self!await-if-last-handle })); | |
- ++$!active-handles; | |
- @!pre-spawn.push({ | |
- $!proc.stdout(:bin).merge($!proc.stderr(:bin)).act: { $chan.send($_) }, | |
- done => { $chan.close }, | |
- quit => { $chan.fail($_) } | |
- }); | |
+ if nqp::istype($out, IO::Handle) { | |
+ @!pre-spawn.push: { | |
+ $!proc.bind-stdout: $out; | |
+ $!proc.bind-stderr: $out; | |
+ } | |
+ } | |
+ else { | |
+ my $chan = Channel.new; | |
+ $!out = IO::Pipe.new(:proc(self), :$chomp, :$enc, :$bin, nl-in => $nl, | |
+ :on-read({ (try $chan.receive) // buf8 }), | |
+ :on-close({ self!await-if-last-handle })); | |
+ ++$!active-handles; | |
+ @!pre-spawn.push({ | |
+ $!proc.stdout(:bin).merge($!proc.stderr(:bin)).act: { $chan.send($_) }, | |
+ done => { $chan.close }, | |
+ quit => { $chan.fail($_) } | |
+ }); | |
+ } | |
} | |
else { | |
if $out === True { |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment