Skip to content

Commit

Permalink
Fix error "callback is not a function" #25
Browse files Browse the repository at this point in the history
  • Loading branch information
tarmolov committed Sep 27, 2016
1 parent d317d7b commit 47f76df
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions lib/git-hooks.js
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,15 @@ module.exports = {
var hookName = path.basename(filename);
var hooksDirname = path.resolve(path.dirname(filename), '../../.githooks', hookName);

// workaround for backward copmatibility
// npm 3.x doesn't execute preuninstall script
// @see https://github.com/npm/npm/issues/13963
args = [].concat(args) || [];
if (typeof input === 'function') {
callback = input;
input = '';
}

if (fsHelpers.exists(hooksDirname)) {
var list = fs.readdirSync(hooksDirname);
var hooks = list.map(function (hookName) {
Expand Down

0 comments on commit 47f76df

Please sign in to comment.