IO::Async::Process::GracefulShutdown - controlled shutdown of a process
use IO::Async::Process::GracefulShutdown; use IO::Async::Loop; my $loop = IO::Async::Loop; my $process = IO::Async::Process::GracefulShutdown->new( command => [ "my-proc" ], ); $loop->add( $process ); ... $process->shutdown( "TERM" )->get;
This subclass of IO::Async::Process adds a method to perform a shutdown of the invoked process by sending a signal. If after some delay the process has not yet exited, it is sent a
$process->shutdown( $signal, %args )->get
Requests the process shut down by sending it the given signal (either specified by name or number). If the process does not shut down after a timeout,
SIGKILL is sent instead.
The returned future will complete when the process exits.
Takes the following named arguments:
- timeout => NUM
Optional. Number of seconds to wait for exit before sending
SIGKILL. Defaults to 10 seconds.
- on_kill => CODE
Optional. Callback to invoke if the timeout occurs and
SIGKILLis going to be sent. Intended for printing or logging purposes; this doesn't have any material effect on the process otherwise.
$on_kill->( $process )
Paul Evans <email@example.com>