-
-
Save anonymous/35ea6d9b1fb709fea7dcca8fd349168d 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/lib/Mojo/IOLoop/Subprocess.pm b/lib/Mojo/IOLoop/Subprocess.pm | |
index 0093df73b..f61fde9c0 100644 | |
--- a/lib/Mojo/IOLoop/Subprocess.pm | |
+++ b/lib/Mojo/IOLoop/Subprocess.pm | |
@@ -12,6 +12,8 @@ has deserialize => sub { \&Storable::thaw }; | |
has ioloop => sub { Mojo::IOLoop->singleton }; | |
has serialize => sub { \&Storable::freeze }; | |
+sub DESTROY { kill 'KILL', $_[0]{pid} if $_[0]{pid} } | |
+ | |
sub pid { shift->{pid} } | |
sub run { | |
@@ -45,6 +47,7 @@ sub run { | |
waitpid $pid, 0; | |
my $results = eval { $self->deserialize->($buffer) } || []; | |
$self->$parent(shift(@$results) // $@, @$results); | |
+ delete $self->{pid}; | |
} | |
); | |
return $self; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment