in reply to best way to kill a spawned process
use strict; use warnings; if (my $child = fork) { # foreground process sleep 5; kill 9, $child; } else { # background process exec("arecord", "file.wav"); }
The fork plus exec combination allows you to cleanly launch a background process, and gives you the PID for the background process, which can later be passed to kill.
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: best way to kill a spawned process
by redss (Monk) on Feb 05, 2013 at 17:19 UTC | |
by Anonymous Monk on Feb 05, 2013 at 17:44 UTC |