Skip to content

Instantly share code, notes, and snippets.

@neonstalwart
Created June 7, 2011 02:20
Show Gist options
  • Save neonstalwart/1011563 to your computer and use it in GitHub Desktop.
Save neonstalwart/1011563 to your computer and use it in GitHub Desktop.
diff --git a/lib/DAV/plugins/codesearch.js b/lib/DAV/plugins/codesearch.js
index 9d3f77b..d961af0 100644
--- a/lib/DAV/plugins/codesearch.js
+++ b/lib/DAV/plugins/codesearch.js
@@ -152,12 +152,12 @@ jsDAV_Codesearch_Plugin.MAXSIZE = 2097152; //2MB
if (!Util.isTrue(options.casesensitive))
cmd += " -i ";
var t,
- include = "*.{" + jsDAV_Codesearch_Plugin.PATTERN_EXT + "}";
+ include = "\\*.{" + jsDAV_Codesearch_Plugin.PATTERN_EXT + "}";
if (!Util.empty(options.pattern) && (t = jsDAV_Codesearch_Plugin.MAPPINGS[options.pattern]))
- include = (t.length > 1 ? "*.{" : "*.") + t.join(",") + (t.length > 1 ? "}" : "");
+ include = (t.length > 1 ? "\\*.{" : "\\*.") + t.join(",") + (t.length > 1 ? "}" : "");
if (options.maxresults)
cmd += "-m " + parseInt(options.maxresults);
- cmd += " --exclude=*{" + jsDAV_Codesearch_Plugin.PATTERN_EDIR + "}*"
+ cmd += " --exclude=\\*{" + jsDAV_Codesearch_Plugin.PATTERN_EDIR + "}\\*"
+ " --include=" + include + " \""
+ Util.escapeShell(options.query)
+ "\" \"" + node.path + "\"";
@@ -166,7 +166,7 @@ jsDAV_Codesearch_Plugin.MAXSIZE = 2097152; //2MB
var out = "",
err = "",
- grep = Spawn("/bin/bash", ["-c", cmd]);
+ grep = Spawn("/bin/csh", ["-c", cmd]);
grep.stdout.setEncoding("utf8");
grep.stderr.setEncoding("utf8");
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment