Message253468
I expect following code prints '\x1c' when I resize terminal window on Linix/Mac terminal.
--------------------------------
import select, os, signal
rfd, wfd = os.pipe()
os.set_blocking(wfd, False)
signal.set_wakeup_fd(wfd)
select.select([rfd], [], [])
print(os.read(rfd, 2))
--------------------------------
Resizing terminal window make SIGWINCH signal sent to Python process. But nothing written to fd I specified to set_wakeup_fd().
I checked Modules/signalmodule.c and found I should assign signal handler for the signal I want to wakeup fd. So following code works as I expected.
--------------------------------
import select, os, signal
rfd, wfd = os.pipe()
os.set_blocking(wfd, False)
signal.set_wakeup_fd(wfd)
signal.signal(signal.SIGWINCH, lambda *args:0)
select.select([rfd], [], [])
print(os.read(rfd, 2))
--------------------------------
Is this an expected behavior of signal.set_wakeup_fd()? |
|
Date |
User |
Action |
Args |
2015-10-26 11:34:56 | ishimoto | set | recipients:
+ ishimoto |
2015-10-26 11:34:56 | ishimoto | set | messageid: <1445859296.06.0.537058365711.issue25482@psf.upfronthosting.co.za> |
2015-10-26 11:34:56 | ishimoto | link | issue25482 messages |
2015-10-26 11:34:55 | ishimoto | create | |
|