bug-bash
[Top][All Lists]
Advanced

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

CHLD traps run at the same time


From: Øyvind 'bolt' Hvidsten
Subject: CHLD traps run at the same time
Date: Wed, 14 Jan 2015 12:01:14 +0100
User-agent: Cathedral Secure Mail v0.8

I'm responsible for a couple of scripts at work, which have used a trap on CHLD to do some naive parallelisation, starting a new child process when an existing one ends.

However, when run under bash 4.3.30, all CHLD traps run at the same time, so my script runs in chunks, rather than keeping a given amount of processes running at all times. I've been told I can rewrite it using wait -n instead, but I'm wondering if this is classified as a bug, or if it's intended to be that way going forwards.

Here's a quick example of what happens (from shbot in #bash on freenode):

43# bash -c "echo \$BASH_VERSION; set -m; trap 'date' CHLD; sleep 1 & sleep 3"
4.3.30(1)-release
[1]+  Done                    sleep 1
Wed Jan 14 10:58:33 UTC 2015
Wed Jan 14 10:58:33 UTC 2015

42# bash -c "echo \$BASH_VERSION; set -m; trap 'date' CHLD; sleep 1 & sleep 3"
4.2.53(1)-release
Wed Jan 14 10:58:36 UTC 2015
Wed Jan 14 10:58:38 UTC 2015
[1]+  Done                    sleep 1



reply via email to

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