, , DSUSP.
, , issue 7695 Python bug tracker. , VDSUSP termios 3.4.
Glibc,
: int VDSUSP
DSUSP . termios.c_cc[VDSUSP] .
DSUSP (suspend) , (. " " ). SIGTSTP, SUSP, - , . DSUSP; BSD- ( GNU/Hurd).
, , VDSUSP termios - 3.4;
if any(i in sys.platform for i in ['bsd', 'darwin']):
BSD X; Hurd - , , ( , BSD).
:
import subprocess
import time
from distutils.spawn import find_executable
def exec_cmd(*args):
p = subprocess.Popen(args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, _ = p.communicate()
return stdout
if find_executable('stty'):
modesave = exec_cmd('stty', '-g').strip()
exec_cmd('stty', 'dsusp', 'undef')
print("disabled ctrl-y")
time.sleep(2)
print("enabled ctrl-y")
exec_cmd('stty', modesave)
time.sleep(2)
print("exiting")
, Linux, stty -g .. - POSIX.