Last active
October 17, 2016 16:10
-
-
Save a2ikm/4f61ad421992fb9fb740ec90cbeb8873 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #!/usr/bin/env perl -w | |
| use strict; | |
| $SIG{"CHLD"} = sub { exit; }; | |
| my $pid = fork(); | |
| if ($pid) { | |
| foreach my $sig (qw(TERM INT QUIT)) { | |
| $SIG{$sig} = sub { | |
| kill $sig, $pid; | |
| }; | |
| } | |
| waitpid($pid, 0); | |
| } else { | |
| exec "long long command"; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment