From: Vincent Stemen <zsh@hightek.org>
To: zsh-users@sunsite.dk
Subject: localtraps
Date: Mon, 25 Apr 2005 01:35:21 -0500 [thread overview]
Message-ID: <20050425063521.GA17598@quark.hightek.org> (raw)
Hi.
I don't seem to be able to get the localtraps option to work.
Here is my test script
<test script>
#!/bin/zsh
# sigtest
signal()
{
setopt LOCAL_TRAPS
trap "echo 'executing local signal() trap'" INT
echo "--- got signal ---"
sleep 2
}
trap signal INT
for n in 1 2 3 4 5 6
do
echo -n "."
sleep 1
done
echo
</test script>
<My expected result>
I expected to see "--- got signal ---" if I hit ^C, then, if I hit ^C
again within 2 seconds, before it exits signal(), I expected to see
"executing local signal() trap". If I wait at least 2 seconds until I
see another '.' printed, then hit ^C again, I expected to see
"--- got signal ---" again.
</expected result>
On zsh 4.2.0 (i386-unknown-freebsd5.2.1)
the trap inside signal() seems to have no effect. Here is what I got
# ./sigtest
.^C--- got signal ---
^C--- got signal ---
^C--- got signal ---
..^C--- got signal ---
..
If I do not set localtraps, then the trap inside signal() works as
expected.
# ./sigtest
^C--- got signal ---
^Cexecuting local signal() trap
.^Cexecuting local signal() trap
.^Cexecuting local signal() trap
..^Cexecuting local signal() trap
.
On zsh 4.2.1 (i386--netbsdelf)
I got a different result with localtraps set.
# ./sigtest
.^C--- got signal ---
^C^Cexecuting local signal() trap
..^Cexecuting local signal() trap
...
As you can see, on 4.2.1 the trap inside signal() works, but the
"setopt LOCAL_TRAPS" has no effect. It never resets the signal back
when it exits the signal() function.
If I was doing something wrong, I expected to get the same result on
both systems. Am I overlooking something?
Regards,
Vincent
--
Vincent Stemen
Avoid the VeriSign/Network Solutions domain registration trap!
Read how Network Solutions (NSI) was involved in stealing our domain name.
http://www.InetAddresses.net
next reply other threads:[~2005-04-25 6:37 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-04-25 6:35 Vincent Stemen [this message]
2005-04-25 16:32 ` localtraps Bart Schaefer
2005-04-26 0:50 ` localtraps Vincent Stemen
2005-04-26 3:03 ` localtraps Vincent Stemen
2005-04-26 18:34 ` localtraps Peter Stephenson
2005-04-26 22:12 ` localtraps Vincent Stemen
2005-04-27 5:59 ` localtraps Bart Schaefer
2005-04-28 1:00 ` localtraps Vincent Stemen
2005-04-28 8:20 ` localtraps Bart Schaefer
2005-04-27 5:36 ` localtraps Bart Schaefer
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20050425063521.GA17598@quark.hightek.org \
--to=zsh@hightek.org \
--cc=zsh-users@sunsite.dk \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).