2

I'm trying to do a long blocking read call inside a python script supplied with the python command:

python3 << EOF
import ctypes
libc=ctypes.CDLL("libc.so.6")
ch = ctypes.create_string_buffer(1)
r = libc.read(3,ch,1) #raw syscall, because pythons os.read restarts on EINTR
EOF

I would like for the read call to be breakable with signal-generated signals such as SIGINT (generated by Ctrl+C).

Unfortunately, vim seems to run the python snippet with the terminal set not to generated this signal upon a Ctrl+C.

How can I run this snippet so that Ctlr+C continues to generates SIGINT even inside of the snippet? Also, how can the vimscript that calls the python snippet tell if the python succeeded or not?

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.