lib/git-hooks.js
function spawnHook(hookName, args) {
    var stats = fs.statSync(hookName);
    var command = hookName;
    var opts = args;
    var hook;

    if (isWin32) {
        hook = fs.readFileSync(hookName).toString();
        if (!require('shebang-regex').test(hook)) {
            throw new Error('Cannot find shebang in hook: ' + hookName + '.');
        }
        command = require('shebang-command')(require('shebang-regex').exec(hook)[0]);
        opts = [hookName].concat(opts);
        if (command === 'node') {
            command = 'node.exe';
        }
    } else if (!(stats && stats.isFile() && isExecutable(stats))) {
        throw new Error('Cannot execute hook: ' + hookName + '. Please check file permissions.');
    }
    return spawn(command, opts, {stdio: 'inherit'});
}
function spawnHook(hookName, args) {
    var stats = fs.statSync(hookName);
    var command = hookName;
    var opts = args;
    var hook;

    if (isWin32) {
        hook = fs.readFileSync(hookName).toString();
        if (!require('shebang-regex').test(hook)) {
            throw new Error('Cannot find shebang in hook: ' + hookName + '.');
        }
        command = require('shebang-command')(require('shebang-regex').exec(hook)[0]);
        opts = [hookName].concat(opts);
        if (command === 'node') {
            command = 'node.exe';
        }
    } else if (!(stats && stats.isFile() && isExecutable(stats))) {
        throw new Error('Cannot execute hook: ' + hookName + '. Please check file permissions.');
    }
    return spawn(command, opts, {stdio: 'inherit'});
}
function spawnHook ( hookName , args ) { var stats = fs . statSync ( hookName ) ; var command = hookName ; var opts = args ; var hook ; if ( isWin32 ) { hook = fs . readFileSync ( hookName ) . toString ( ) ; if ( ! require ( 'shebang-regex' ) . test ( hook ) ) { throw new Error ( 'Cannot find shebang in hook: ' + hookName + '.' ) ; } command = require ( 'shebang-command' ) ( require ( 'shebang-regex' ) . exec ( hook ) [ 0 ] ) ; opts = [ hookName ] . concat ( opts ) ; if ( command === 'node' ) { command = 'node.exe' ; } } else if ( ! ( stats && stats . isFile ( ) && isExecutable ( stats ) ) ) { throw new Error ( 'Cannot execute hook: ' + hookName + '. Please check file permissions.' ) ; } return spawn ( command , opts , { stdio : 'inherit' } ) ; }
Spawns hook as a separate process.

@param {String} hookName
@param {String[]} args
@returns {ChildProcess}
Spawns hook as a separate process .