zsh-users
 help / color / mirror / code / Atom feed
* TRAPEXIT doesn't get executed
@ 2000-11-07 18:35 Matt Armstrong
  2000-11-07 19:07 ` Bart Schaefer
  0 siblings, 1 reply; 2+ messages in thread
From: Matt Armstrong @ 2000-11-07 18:35 UTC (permalink / raw)
  To: zsh-users

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


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-11-07 19:08 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-11-07 18:35 TRAPEXIT doesn't get executed Matt Armstrong
2000-11-07 19:07 ` Bart Schaefer

Code repositories for project(s) associated with this public inbox

	https://git.vuxu.org/mirror/zsh/

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).