From: Bart Schaefer <schaefer@brasslantern.com>
To: Andre Albsmeier <Andre.Albsmeier@siemens.com>, zsh-users@zsh.org
Subject: Re: exec'ing $0 in traps
Date: Fri, 17 Feb 2017 12:02:19 -0800 [thread overview]
Message-ID: <170217120219.ZM11847@torch.brasslantern.com> (raw)
In-Reply-To: <20170217081604.GA59728@bali>
On Feb 17, 9:16am, Andre Albsmeier wrote:
}
} #!/bin/zsh
}
} echo started
} trap 'echo trapped; exec "$0"' 1
}
} echo $$ > /tmp/blafasel
}
} while read line; do
} echo line $line
} done
Some combination of the "read" builtin plus calling "exec" from inside
the signal handler is causing the HUP signal to remain blocked across
the "exec" -- and re-installing the trap doesn't unblock it.
If I replace the read-loop with
sleep 3
kill -1 $$
then the process restarts itself every 3 seconds as expected.
So, you aren't doing anything explicitly wrong.
next prev parent reply other threads:[~2017-02-17 20:30 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-02-17 8:16 Andre Albsmeier
2017-02-17 20:02 ` Bart Schaefer [this message]
2017-02-18 10:24 ` Andre Albsmeier
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=170217120219.ZM11847@torch.brasslantern.com \
--to=schaefer@brasslantern.com \
--cc=Andre.Albsmeier@siemens.com \
--cc=zsh-users@zsh.org \
/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).