##// END OF EJS Templates
Moving extensions to either quarantine or deathrow....
Moving extensions to either quarantine or deathrow. When a module is moved to quarantine, it means that while we intend to keep it, it is currently broken or sufficiently untested that it can't be in the main IPython codebase. To be moved back into the main IPython codebase a module must: 1. Work fully. 2. Have a test suite. 3. Be a proper IPython extension and tie into the official APIs. 3. Have members of the IPython dev team who are willing to maintain it. When a module is moved to deathrow, it means that the code is either broken and not worth repairing, deprecated, replaced by newer functionality, or code that should be developed and maintained by a third party.

File last commit:

r2267:928c921b
r2267:928c921b
Show More
ipy_signals.py
61 lines | 1.7 KiB | text/x-python | PythonLexer
vivainio
Add ipy_signals for better ctrl + C processing
r477 """ Advanced signal (e.g. ctrl+C) handling for IPython
So far, this only ignores ctrl + C in IPython file a subprocess
is executing, to get closer to how a "proper" shell behaves.
Other signal processing may be implemented later on.
If _ip.options.verbose is true, show exit status if nonzero
"""
vivainio
ipy_signals win32 version
r480 import signal,os,sys
Brian Granger
ipapi.py => core/ipapi.py and imports updated.
r2027 from IPython.core import ipapi
vivainio
Add ipy_signals for better ctrl + C processing
r477 import subprocess
Brian Granger
ipapi.py => core/ipapi.py and imports updated.
r2027 ip = ipapi.get()
vivainio
Add ipy_signals for better ctrl + C processing
r477
vivainio
ipy_signals win32 version
r480 def new_ipsystem_posix(cmd):
vivainio
Add ipy_signals for better ctrl + C processing
r477 """ ctrl+c ignoring replacement for system() command in iplib.
Ignore ctrl + c in IPython process during the command execution.
The subprocess will still get the ctrl + c signal.
vivainio
ipy_signals win32 version
r480
posix implementation
vivainio
Add ipy_signals for better ctrl + C processing
r477 """
p = subprocess.Popen(cmd, shell = True)
old_handler = signal.signal(signal.SIGINT, signal.SIG_IGN)
pid,status = os.waitpid(p.pid,0)
signal.signal(signal.SIGINT, old_handler)
if status and ip.options.verbose:
print "[exit status: %d]" % status
vivainio
ipy_signals win32 version
r480 def new_ipsystem_win32(cmd):
""" ctrl+c ignoring replacement for system() command in iplib.
Ignore ctrl + c in IPython process during the command execution.
The subprocess will still get the ctrl + c signal.
win32 implementation
"""
old_handler = signal.signal(signal.SIGINT, signal.SIG_IGN)
status = os.system(cmd)
signal.signal(signal.SIGINT, old_handler)
if status and ip.options.verbose:
print "[exit status: %d]" % status
vivainio
Add ipy_signals for better ctrl + C processing
r477 def init():
o = ip.options
try:
o.verbose
except AttributeError:
o.allow_new_attr (True )
o.verbose = 0
Brian Granger
Continuing a massive refactor of everything.
r2205 ip.system = (sys.platform == 'win32' and new_ipsystem_win32 or
vivainio
ipy_signals win32 version
r480 new_ipsystem_posix)
vivainio
Add ipy_signals for better ctrl + C processing
r477
init()