Example #1
0
File: core.py Project: geophile/osh
def _ctrl_c_handler(signal, frame):
    # Set error and exception handlers to be quiet.
    import error
    error.set_stderr_handler(lambda line, op, input, thread: None)
    error.set_exception_handler(lambda exception, op, input, thread: None)
    # kill spawned processes (including remote)
    spawn.kill_all_processes()
Example #2
0
def set_exception_handler(handler):
    """Replaces the standard exception handler (which prints to stderr). An exception handler
    takes these arguments:
        - C{exception}: The exception being handled.
        - C{op}: The operation that caused the exception.
        - C{input}: The input to the operation that caused the exception.
        - C{host}: The host on which the exception occurred (in case of remote execution).
    """
    error.set_exception_handler(handler)