On 02/09, Bob Proulx wrote: > > Oleg Nesterov wrote: > > Bob Proulx wrote: > > > Is the behavior you observe any different for this case? > > > $ bash -c 'while true; do /bin/true || exit 1; done' > > > Or different for this case? > > > $ bash -e -c 'while true; do /bin/true; done' > > > > The same. > > I expected that to behave differently for you because I expected that > the issue was that /bin/true was being delivered the signal but the > exit status of /bin/true is being ignored in your test case. In your > test case if /bin/true caught the SIGINT then I expect the loop to > continue. Since you were saying that it was continuing then that is > what I was expecting was happening.
Well, it is too late for me ;) perhaps I misunderstood your point. But I think this doesn't matter, see below. > > I do not know what "-e" does (and I can't find it in man), but how > > this can make a difference? > > The documentation says this about -e: > > [... snip ...] Aha, thanks a lot. > Using -e would cause the shell to exit if /bin/true returned a > non-zero exit status. /bin/true would exit non-zero if it caught a > SIGINT signal. If /bin/true gets SIGINT - everything is fine. With this particular test-case the problem is: ^C race race with true/false/whatever doing exit(any_exit_code). In this case the shell "ignores" the signal. Oleg.