and this doesn't (hangs - can't exit script until java app is closed):#!/usr/bin/perl my $pid = open(my $fh, "java -classpath /Users/allasso/AWS/utility/too +ls_additional/SC_add/java TextEntry |") or die "Couldn't launch: $! / $?"; print "pid: $pid\n\ndoing stuff...\n\npress return to exit script...\n +\n"; <STDIN>; if ($pid) { kill 9 => $pid; # bang };
#!/usr/bin/perl my $pid = open(my $fh, "java -classpath /Users/allasso/AWS/utility/too +ls_additional/SC_add/java TextEntry |") or die "Couldn't launch: $! / $?"; END { if ($pid) { kill 9 => $pid; # bang }; }; print "pid: $pid\n\ndoing stuff...\n\npress return to exit script...\n +\n"; <STDIN>;
In reply to Re: how to kill background process when script exit?
by Allasso
in thread how to kill background process when script exit?
by Allasso
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |