From 04423c45fabb9bb4ff2a0bc71bce250cb4eaa7c0 Mon Sep 17 00:00:00 2001 From: Will Fleming Date: Wed, 18 Nov 2015 20:27:56 -0500 Subject: [PATCH] quote filename shelling out to grep If a path has a space in it, the grep will fail unless we quote the filename. --- lib/fix-me.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/lib/fix-me.js b/lib/fix-me.js index 65834bf..8b85231 100644 --- a/lib/fix-me.js +++ b/lib/fix-me.js @@ -35,7 +35,8 @@ FixMe.prototype.find = function(file){ self = this; // Prepare the grep string for execution (uses BusyBox grep) - var grepString = "grep -inHwoE " + fixmeStrings + " " + file; + var grepString = ["grep -inHwoE", fixmeStrings, '"' + file + '"'].join(" "); + // Execute grep with the FIXME patterns exec(grepString, function (error, stdout, stderr) {