[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: New util suggestion: timeout
From: |
Paul Jarc |
Subject: |
Re: New util suggestion: timeout |
Date: |
Mon, 28 Jun 2004 12:28:56 -0400 |
User-agent: |
Gnus/5.110003 (No Gnus v0.3) Emacs/21.3 (gnu/linux) |
Paul Eggert <address@hidden> wrote:
> address@hidden (Paul Jarc) writes:
>> How would you limit wall-clock time? Schedule SIGALRM with
>> setitimer and then exec the given command?
>
> I've long used a command of my own called 'alarm' that just does that.
> However, this strategy doesn't always work well if the command has
> subprocesses, since the signal is sent only to the exec'ed process.
It also fails if the command uses setitimer itself. That could be
handled by forking and having the parent send SIGTERM to the child
when it gets its own SIGALRM. To handle the child processes, a new
process group could be created, but that might interfere with other
things.
paul