timeout.pl 172 B

123456789
  1. #!/usr/bin/perl -w
  2. use strict;
  3. my $usage = "timeout <seconds> <command ...>\n";
  4. my $timeout = shift || die $usage;
  5. alarm($timeout);
  6. exec @ARGV;
  7. die "exec failed: @ARGV";