示例#1
0
def _log_and_exit(msg, exc, formatted, write_fn=sys_stdout_write_wrapper):
    error_msg = '{0}: {1}: {2}\n'.format(msg, type(exc).__name__, exc)
    write_fn(error_msg)
    write_fn('Check the log at ~/.pre-commit/pre-commit.log\n')
    store = Store()
    store.require_created()
    with io.open(os.path.join(store.directory, 'pre-commit.log'), 'wb') as log:
        log.write(five.to_bytes(error_msg))
        log.write(five.to_bytes(formatted) + b'\n')
    raise PreCommitSystemExit(1)
示例#2
0
def _log_and_exit(msg, exc, formatted, print_fn=print):
    error_msg = '{0}: {1}: {2}'.format(msg, type(exc).__name__, exc)
    print_fn(error_msg)
    print_fn('Check the log at ~/.pre-commit/pre-commit.log')
    store = Store()
    store.require_created()
    with io.open(os.path.join(store.directory, 'pre-commit.log'), 'w') as log:
        log.write(error_msg + '\n')
        log.write(formatted + '\n')
    raise PreCommitSystemExit(1)
示例#3
0
def _log_and_exit(msg, exc, formatted):
    error_msg = b''.join((
        five.to_bytes(msg), b': ',
        five.to_bytes(type(exc).__name__), b': ',
        _to_bytes(exc), b'\n',
    ))
    output.write(error_msg)
    output.write_line('Check the log at ~/.pre-commit/pre-commit.log')
    store = Store()
    store.require_created()
    with io.open(os.path.join(store.directory, 'pre-commit.log'), 'wb') as log:
        output.write(error_msg, stream=log)
        output.write_line(formatted, stream=log)
    raise PreCommitSystemExit(1)
示例#4
0
def _log_and_exit(msg, exc, formatted):
    error_msg = b''.join((
        five.to_bytes(msg), b': ',
        five.to_bytes(type(exc).__name__), b': ',
        _to_bytes(exc), b'\n',
    ))
    output.write(error_msg)
    output.write_line('Check the log at ~/.pre-commit/pre-commit.log')
    store = Store()
    store.require_created()
    with open(os.path.join(store.directory, 'pre-commit.log'), 'wb') as log:
        output.write(error_msg, stream=log)
        output.write_line(formatted, stream=log)
    raise PreCommitSystemExit(1)