signal
signal copied to clipboard
Signal being caught
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?
No this is not intentional.
- What is your platform?
- Are you sure that you don't use other library that captures signals (maybe in some dependency)?
- Do you use
waitwith zero timeout? Try something small non-zero. (Although, zero should also work at least on Linux) - Also try iterating (or just
trap.next()) and see if you encounter the signal this way. - You your program has threads? Can it accidentally create two
Trap's in parallel?
- Linux
- Yes
- using Instant::now()
- Code has been deleted currently so can't test right now
- 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.