Liste des Groupes | Revenir à cu shell |
On Mon, 6 May 2024 12:08:39 -0000 (UTC), gazelle@shell.xmission.com (Kenny
McCormack) wrote in <v1ah87$l0a8$1@news.xmission.com>:
In article <20240505214609.114@kylheku.com>,
Kaz Kylheku <643-408-1753@kylheku.com> wrote:On 2024-05-05, Christian Weisgerber <naddy@mips.inka.de> wrote:Is there a standard POSIX shell idiom to clean up background>
processes?
>
You have a shell script that starts some background process with &.
Now you want to make sure that the background process terminates when
the shell script terminates. In particular, when it terminates due to
special circumstances.
Maybe have an EXIT trap which calls wait?
>
The fundamental underlying problem here is that the EXIT trap is only
called on a "normal" exit. In particular, it does not get called under
(at least) the following circumstances:
>
1) User hits ^C causing the script to abort.
I'm sorry, but I've waited and nobody said anything, so
I have to ask: Why couldn't you trap "kill -1 0" INT?
[...]
Les messages affichés proviennent d'usenet.