subproses less.I've tried passing SIGINT through a subprocess for a nonsensical purpose of wanting to run it in a Popen.
```py
from subprocess import Popen
from signal import signal, SIGINT
cmd = '/usr/bin/less /var/log/system.log'.split()
p = Popen(cmd)
def send_signal_fn(signum, frame):
p.send_signal(SIGINT)
signal(SIGINT, send_signal_fn)
p.communicate()
Use the signal handler to do `Popen.send_signal (SIGINT)`
when SIGINT
comes.
Now you can come back from `` `less + F``` without dying.
Recommended Posts