I'm looking for the simplest way to run a command in a shell and kill it if it doesn't end in less than a second of CPU time. Something like:
$ deadline -- slow-foo
Started fooing...
[deadline] 1 sec deadline hit, killing and returning -1!
$ deadline -- quick-foo
Started fooing...
Finished fooing!
A linux-based solution is more than enough, but more portable ones are welcome.