Skip to content

Commit 3ac4ca3

Browse files
committed
Fix occasional crashes associtated with timeouts
Just sending a SIGHUP does not mean that we can close the channel, the process is probably still alive and it will attempt to send stuff into a closed channel. This fixes #60. Previously this was the cause of MoarVM panics (until it was fixed in Rakudo), but generally this is our fault. However, there is still at least one bug in rakudo, which is why we did not notice this problem right away. When the command prints a lot of stuff into stdin, it will never time out. The whole thing is stuck in a Proc::Async tap, without giving any chance for Promice.in(…) to fire up.
1 parent 7cd3281 commit 3ac4ca3

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

Whateverable.pm6

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -112,6 +112,7 @@ method get-output(*@run-args, :$timeout = $!timeout, :$stdin) {
112112
$proc.kill; # TODO sends HUP, but should kill the process tree instead
113113
$out.send: «timed out after $timeout seconds, output»: ;
114114
}
115+
await $promise; # wait until it is actually stopped
115116
$out.close;
116117
return $out.list.join.chomp, $promise.result.exitcode, $promise.result.signal, $s-end - $s-start
117118
}

0 commit comments

Comments
 (0)