Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
TRAPEXIT doesn't get executed
- X-seq: zsh-users 3512
- From: Matt Armstrong <matt@xxxxxxxxxxxxxx>
- To: zsh-users@xxxxxxxxxxxxxx
- Subject: TRAPEXIT doesn't get executed
- Date: Tue, 7 Nov 2000 10:35:47 -0800
- Mailing-list: contact zsh-users-help@xxxxxxxxxxxxxx; run by ezmlm
I'm trying to find the right idiom to make sure some cleanup code gets
executed no matter how the script exits.
When I run this script:
---------------------------------------------------------
#!/usr/bin/zsh
set -x
function TRAPEXIT {
print "executed TRAPEXIT"
}
sleep 10
---------------------------------------------------------
And hit Ctrl-C while "sleep 10" is executing, the TRAPEXIT isn't
executed. But when I run this script:
---------------------------------------------------------
#!/usr/bin/zsh
set -x
function TRAPEXIT {
print "executed TRAPEXIT"
}
function TRAPINT {
print "executed TRAPINT"
}
sleep 10
---------------------------------------------------------
And hit Ctrl-C, both TRAPINT and TRAPEXIT get executed. Is this
explained anywhere? The behavior is the same under 3.0 and 3.1, so I
imagine this has been covered before.
--
matt
Messages sorted by:
Reverse Date,
Date,
Thread,
Author