(*arguments)
Wrapper for run() to deal with argv encodings, Ctrl-C, stdio and pipes.
Wrapper for run() to deal with argv encodings, Ctrl-C, stdio and pipes.
Wrapper for run () to deal with argv encodings Ctrl - C stdio and pipes .
def main(*arguments):
    """Wrapper for run() to deal with argv encodings, Ctrl-C, stdio and pipes."""
    try:
        run(*arguments)
    except KeyboardInterrupt:
        pass
    except:
        # without this except clause we seem to be dropping exceptions
        # probably due to the sys.stdout.close() hack below
        logging.error('Unhandled exception\n%s', traceback.format_exc())
    finally:
        # avoid sys.excepthook errors when piping output
        # http://stackoverflow.com/questions/7955138/addressing-sys-excepthook-error-in-bash-script
        try:
            sys.stdout.close()
        except:
            pass
        try:
            sys.stderr.close()
        except:
            pass
def main ( * arguments ) : try : run ( * arguments ) except KeyboardInterrupt : pass except : # without this except clause we seem to be dropping exceptions # probably due to the sys.stdout.close() hack below logging . error ( 'Unhandled exception\n%s' , traceback . format_exc ( ) ) finally : # avoid sys.excepthook errors when piping output # http://stackoverflow.com/questions/7955138/addressing-sys-excepthook-error-in-bash-script try : sys . stdout . close ( ) except : pass try : sys . stderr . close ( ) except : pass