public inbox for dash@vger.kernel.org
 help / color / mirror / Atom feed
* Signal handler not called when trying to open fifo
@ 2024-09-26  8:49 Johannes Altmanninger
  2024-09-26  8:57 ` Johannes Altmanninger
  0 siblings, 1 reply; 2+ messages in thread
From: Johannes Altmanninger @ 2024-09-26  8:49 UTC (permalink / raw)
  To: dash

I'm trying to recover from the state where a fifo reader is
unexpectedly unavailable.  My idea is to signal the writer process
after timeout, to avoid it hanging forever:

	mkfifo fifo
	timeout 1 sh -c 'trap "echo cleanup...; exit" TERM; exec 3>fifo'

This works when using bash or zsh but with dash my signal handler is never called.
Instead I get

	sh: 1: cannot create fifo: Interrupted system call

Is this supposed to work?

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

* Re: Signal handler not called when trying to open fifo
  2024-09-26  8:49 Signal handler not called when trying to open fifo Johannes Altmanninger
@ 2024-09-26  8:57 ` Johannes Altmanninger
  0 siblings, 0 replies; 2+ messages in thread
From: Johannes Altmanninger @ 2024-09-26  8:57 UTC (permalink / raw)
  To: dash

On Thu, Sep 26, 2024 at 10:49:36AM +0200, Johannes Altmanninger wrote:
> I'm trying to recover from the state where a fifo reader is
> unexpectedly unavailable.  My idea is to signal the writer process
> after timeout, to avoid it hanging forever:
> 
> 	mkfifo fifo
> 	timeout 1 sh -c 'trap "echo cleanup...; exit" TERM; exec 3>fifo'
> 
> This works when using bash or zsh but with dash my signal handler is never called.

I realized I can work around this using

	timeout sh ...
	if [ $? -eq 124 ]; then cleanup; fi

That works for me.

> Instead I get
> 
> 	sh: 1: cannot create fifo: Interrupted system call
> 
> Is this supposed to work?

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

end of thread, other threads:[~2024-09-26  8:56 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-09-26  8:49 Signal handler not called when trying to open fifo Johannes Altmanninger
2024-09-26  8:57 ` Johannes Altmanninger

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox