zsh-users
 help / color / mirror / code / Atom feed
* Which signal >(process) receives after main shell exits?
@ 2018-05-11  5:18 Sebastian Gniazdowski
  2018-05-13  4:04 ` Sebastian Gniazdowski
  0 siblings, 1 reply; 2+ messages in thread
From: Sebastian Gniazdowski @ 2018-05-11  5:18 UTC (permalink / raw)
  To: Zsh Users

[-- Attachment #1: Type: text/plain, Size: 501 bytes --]

Hello,

% fun() {
   setopt localtraps
   trap "echo waiting >> /tmp/reply; sleep 2; echo bye >> /tmp/reply; exit
1;" EXIT
   echo "My PID: $sysparams[pid]"
   repeat 1000; do
      read -r -t 1 line
   done
}

% exec {MYFD}> >(fun)
% exit

Above works – fun() will receive the trap, messages will appear in
/tmp/reply.

My question: can be "EXIT" replaced by some actual signal? I've tried PIPE,
HUP, INT, TERM and they didn't work.

-- 
Best regards,
Sebastian Gniazdowski

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

* Re: Which signal >(process) receives after main shell exits?
  2018-05-11  5:18 Which signal >(process) receives after main shell exits? Sebastian Gniazdowski
@ 2018-05-13  4:04 ` Sebastian Gniazdowski
  0 siblings, 0 replies; 2+ messages in thread
From: Sebastian Gniazdowski @ 2018-05-13  4:04 UTC (permalink / raw)
  To: Zsh Users

[-- Attachment #1: Type: text/plain, Size: 603 bytes --]

On 11 May 2018 at 07:18, Sebastian Gniazdowski <sgniazdowski@gmail.com>
wrote:

> Hello,
>    repeat 1000; do
>       read -r -t 1 line
>    done
>

There's a resolution – Zsh apparently doesn't manage >(process). No signal
is being sent. The function exits after main shell exits, because `read`
starts to ignore -t 1 timeout, after it somehow detects that stdin is
invalid. Thus quick 1000 iterations of the loop execute, and `fun` exits,
triggering EXIT trap.

I wonder if this is a discovery of other way of running disowned processes.

-- 
Best regards,
Sebastian Gniazdowski

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

end of thread, other threads:[~2018-05-13  4:05 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-05-11  5:18 Which signal >(process) receives after main shell exits? Sebastian Gniazdowski
2018-05-13  4:04 ` Sebastian Gniazdowski

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).