From 3c4c36068e0ead8d3442da59f46cd72d68a908bb Mon Sep 17 00:00:00 2001 From: Yoshihiro Kikuchi Date: Thu, 14 Jul 2011 15:14:44 +0900 Subject: [PATCH] fs: added an argument check in fs.watchFile Fixes #1324. --- lib/fs.js | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/fs.js b/lib/fs.js index 29e1a3d2b1d..b907021b5cc 100644 --- a/lib/fs.js +++ b/lib/fs.js @@ -629,6 +629,10 @@ fs.watchFile = function(filename) { listener = arguments[1]; } + if (!listener) { + throw new Error('watchFile requires a listener function'); + } + if (options.persistent === undefined) options.persistent = true; if (options.interval === undefined) options.interval = 0;