The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

ptimeout - time out a command, reporting errors

SYNOPSIS

    ptimeout 1h long_running_command

    ptimeout 60m long_running_command

    ptimeout 3600 long_running_command

DESCRIPTION

Takes two or more arguments. The first is the timeout, an integer. With no suffix this is a number of seconds. Can also take suffixes m or h indicating a number of minutes or hours.

The rest is a command and its arguments.

A watchdog process is immediately forked off, and then the command is run in the foreground.

If that command exits before the timeout, ptimeout will kill the watchdog and then replicate the command's exit status in its own.

If the timeout is reached and the command is still running then the watchdog will kill it (using SIGTERM) and all its child processes that can be found, and ptimeout will exit with status 124.

SEE ALSO

GNU timeout

This does not reliably kill child processes in all circumstances.

BUGS

Doesn't work properly on OpenBSD and I have no idea why.

Please report any bugs you find on Github:

https://github.com/DrHyde/perl-modules-App-ptimeout/issues

SOURCE CODE REPOSITORY

git://github.com/DrHyde/perl-modules-App-ptimeout.git

AUTHOR, COPYRIGHT and LICENCE

Copyright 2023 David Cantrell <david@cantrell.org.uk>

This software is free-as-in-speech software, and may be used, distributed, and modified under the terms of either the GNU General Public Licence version 2 or the Artistic Licence. It's up to you which one you use. The full text of the licences can be found in the files GPL2.txt and ARTISTIC.txt, respectively.

CONSPIRACY

This is also free-as-in-mason software.