bug-bash
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

How difficult would it be to add a timeout to "wait"?


From: Dale R. Worley
Subject: How difficult would it be to add a timeout to "wait"?
Date: Thu, 20 Apr 2023 13:53:24 -0400

How difficult would it be to add an optional timeout argument to the
"wait" builtin?

I occasionally run into situations where this functionality is
desirable, more often than I expect, really.  And though the last thing
Bash needs is an additional feature, naively it seems like it wouldn't
be too difficult.  E.g. "read" already has a timeout feature.

But I looked into the code, and all the variations and implementations
of "wait" map reasonably directly into one or another of the Posix
"wait" calls.  I'm no expert there, but I tried looking and there
doesn't seem to be any version of those that allows the program to
specify a timeout time.  I considered setting an alarm() before calling
wait() but a quick look on Stack Overflow said that is a good way to
lose the status information from child jobs.

Dale



reply via email to

[Prev in Thread] Current Thread [Next in Thread]