public inbox for dash@vger.kernel.org
 help / color / mirror / Atom feed
From: Johannes Altmanninger <aclopte@gmail.com>
To: dash@vger.kernel.org
Subject: Re: Signal handler not called when trying to open fifo
Date: Thu, 26 Sep 2024 10:57:30 +0200	[thread overview]
Message-ID: <ZvUh-rllKxZvEgtT@gmail.com> (raw)
In-Reply-To: <ZvUgIAOfG-TXB_Wf@gmail.com>

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?

      reply	other threads:[~2024-09-26  8:56 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-09-26  8:49 Signal handler not called when trying to open fifo Johannes Altmanninger
2024-09-26  8:57 ` Johannes Altmanninger [this message]

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=ZvUh-rllKxZvEgtT@gmail.com \
    --to=aclopte@gmail.com \
    --cc=dash@vger.kernel.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.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox