Skip to content

Commit fea0e9a

Browse files
committed
fix #130
1 parent 3883ccf commit fea0e9a

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

lib/hook.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,12 @@ module.exports = function (cfg, wrapper, callback) {
1717
* Patch the specified method to watch the file at the given argument
1818
* index.
1919
*/
20-
function patch(obj, method, fileArgIndex) {
20+
function patch(obj, method, optionsArgIndex) {
2121
var orig = obj[method];
22+
if (!orig) return;
2223
obj[method] = function () {
23-
var file = arguments[fileArgIndex];
24+
var opts = arguments[optionsArgIndex];
25+
var file = typeof opts == 'string' ? opts : opts.filename;
2426
if (file) callback(file);
2527
return orig.apply(this, arguments);
2628
};

0 commit comments

Comments
 (0)