Manfred Spraul <manfred@colorfullife.com> wrote:
> When bash executes a command, it sometimes creates a subprocess.
> make_child saves the new pid in a global variable (last_made_pid).
> execute_command_internal() calls execute_simple_command() and checks
> if last_made_pid has changed during the call. If last_made_pid has not
> changed (command was a builtin, handled without fork()), then wait_for()
> is not called by execute_command_internal(), to prevent bash from
> hanging.
I haven't looked closely at the code, but it sounds like there should
be a separate boolean variable recording whether make_child forked,
rather than overloading a pid_t variable this way.
paul