The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Process::KillGroup - Kill process and all other belonging to the same process group

VERSION

version 0.01

SYNOPSIS

 use Process::KillGroup qw(kill_group);

 my $pid = ...;
 kill_group pid => $pid, signal => 'KILL';

DESCRIPTION

This module provides kill_group().

FUNCTIONS

None are exported by default, but they are exportable.

kill_group(%args) -> RESULT

Kill process and all other belonging to the same process group.

To find out about child processes, Sys::Statistics::Linux::Processes is used on Linux. Croaks on other operating systems.

Returns the killed PIDs.

This function supports dry-run (simulation) mode. To run in dry-run mode, add argument -dry_run => 1.

Arguments (* denotes required arguments):

  • action => code

    If specified, will call action instead of killing the processes.

    Code will be supplied $pids, an arrayref containing all the PIDs to kill.

  • pid => int

    Process ID to kill.

    Either pid or pids must be specified

  • pids => array

    Process IDs to kill.

    Either pid or pids must be specified

  • signal => str (default "TERM")

    Signal to use, either numeric (e.g. 1), or string (e.g. KILL).

SEE ALSO

Process::KillTree

AUTHOR

Steven Haryanto <stevenharyanto@gmail.com>

COPYRIGHT AND LICENSE

This software is copyright (c) 2011 by Steven Haryanto.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.