Perl - 14 bytes
alarm<>;{redo}
alarm<>;{redo}
Sets a SIGALRM
to be sent in input
seconds, which terminates the script. In the meantime, it spins in a busy-wait.
Sample usage:
$ echo 4 | perl stress.pl
Terminating on signal SIGALRM(14)
$ echo 4 | perl stress.pl
Terminating on signal SIGALRM(14)
Perl - 12 (+1) bytes
If command line options are counted as one byte each, this could be reduced to 13 bytes using a -n
:
alarm;{redo}
alarm;{redo}
Sample usage:
$ echo 4 | perl -n stress.pl
Terminating on signal SIGALRM(14)
$ echo 4 | perl -n stress.pl
Terminating on signal SIGALRM(14)