bug-findutils
[Top][All Lists]
Advanced

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

Re: on interrupt, xargs does not wait for subprocess to exit


From: Dale R. Worley
Subject: Re: on interrupt, xargs does not wait for subprocess to exit
Date: Thu, 27 Aug 2015 21:50:29 -0400

Frederik Eaton <address@hidden> 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



reply via email to

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