Frederik Eaton <frede...@ofb.net> writes: > In brief: > > $ seq 1 10 | xargs sh -c 'trap "" INT; sleep 3; echo hi' > ^C > [130]$ hi > > Notice that I pressed ^C and xargs exited, the shell prompt appeared, > some seconds later the word "hi" appeared. > > Is this the correct behavior for xargs? It could be somewhat annoying > in certain cases. > > I'm not currently subscribed so please Cc me!
I think it is typical behavior. If I understand correctly, xargs does not propagate the ^C to its subprocesses. Instead, the kernel sends the appropriate signal to all of the relevant descendants of the shell. In this case, "seq", "xargs", "sh", and "sleep". Actually, how things work with the descendants of the sub-shell, I don't know. But in general, all of those processes will die in their own way, asychronously. Dale