bb_test.py
def run(cmd, *args, **kwargs):
    """Run a process, and kill the processes when the user ^C's or terminates"""
    cmdobj = getattr(sh, cmd)
    process = cmdobj(*args, _in='/dev/null', _bg=True, **kwargs)
    sid = os.getsid(process.pid)
    try:
        process.wait()
    except BaseException:
        try:
            os.kill(sid, signal.SIGTERM)
        except OSError as exc:
            if exc.errno == errno.ESRCH:
                return process.stdout
            sys.stderr.write("error killing child processes")
        raise
    return process.stdout
Run a process, and kill the processes when the user ^C's or terminates
Run a process, and kill the processes when the user ^C's or terminates
Run a process and kill the processes when the user ^C ' s or terminates
def run(cmd, *args, **kwargs):
    cmdobj = getattr(sh, cmd)
    process = cmdobj(*args, _in='/dev/null', _bg=True, **kwargs)
    sid = os.getsid(process.pid)
    try:
        process.wait()
    except BaseException:
        try:
            os.kill(sid, signal.SIGTERM)
        except OSError as exc:
            if exc.errno == errno.ESRCH:
                return process.stdout
            sys.stderr.write("error killing child processes")
        raise
    return process.stdout
def run ( cmd , * args , ** kwargs ) : cmdobj = getattr ( sh , cmd ) process = cmdobj ( * args , _in = '/dev/null' , _bg = True , ** kwargs ) sid = os . getsid ( process . pid ) try : process . wait ( ) except BaseException : try : os . kill ( sid , signal . SIGTERM ) except OSError as exc : if exc . errno == errno . ESRCH : return process . stdout sys . stderr . write ( "error killing child processes" ) raise return process . stdout
Run a process, and kill the processes when the user ^C's or terminates
Run a process and kill the processes when the user ^C ' s or terminates
"""Run a process, and kill the processes when the user ^C's or terminates"""
cmd