signal icon indicating copy to clipboard operation
signal copied to clipboard

Signal being caught

Open Morganamilo opened this issue 4 years ago • 2 comments

I'm trapping sigterm and then waiting for user input on stdin.

When I pkill the process it does successfully ignore the signal. But when I hit enter to continue .wait() returns None even though I believe that should have been caught as a pending signal.

.wait() does return the signal if i call .wait() with a timeout and pkill while it waits. with a timeout and pkill during the timeout.

Is this intentional?

Morganamilo avatar Nov 09 '21 23:11 Morganamilo

No this is not intentional.

  1. What is your platform?
  2. Are you sure that you don't use other library that captures signals (maybe in some dependency)?
  3. Do you use wait with zero timeout? Try something small non-zero. (Although, zero should also work at least on Linux)
  4. Also try iterating (or just trap.next()) and see if you encounter the signal this way.
  5. You your program has threads? Can it accidentally create two Trap's in parallel?

tailhook avatar Nov 09 '21 23:11 tailhook

  1. Linux
  2. Yes
  3. using Instant::now()
  4. Code has been deleted currently so can't test right now
  5. One thread

I ended up moving to signal-hook and that worked. So I no longer have the code with issue around but I guess I could make a minimal reproducible example some time.

Morganamilo avatar Nov 10 '21 00:11 Morganamilo