Skip to content

Commit

Permalink
Document with_rebuilt.ignoring
Browse files Browse the repository at this point in the history
  • Loading branch information
tkf committed Aug 17, 2018
1 parent 1d75179 commit a1f0b4b
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions julia/with_rebuilt.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,18 @@ def maybe_rebuild(rebuild, julia):

@contextmanager
def ignoring(sig):
"""
Context manager for ignoring signal `sig`.
For example,::
with ignoring(signal.SIGINT):
do_something()
would ignore user's ctrl-c during ``do_something()``. This is
useful when launching interactive program (in which ctrl-c is a
valid keybinding) from Python.
"""
s = signal.signal(sig, signal.SIG_IGN)
try:
yield
Expand Down

0 comments on commit a1f0b4b

Please sign in to comment.