We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 2fa7aec commit c1c8c57Copy full SHA for c1c8c57
1 file changed
lib/index.mjs
@@ -1,5 +1,5 @@
1
import { fileURLToPath } from "node:url";
2
-import { isAbsolute } from "node:path";
+import { isAbsolute, resolve } from "node:path";
3
4
export const rgPath = fileURLToPath(new URL("./rg.mjs", import.meta.url));
5
@@ -25,8 +25,10 @@ export async function ripgrep(args = [], options = {}) {
25
// without requiring the caller to manually configure preopens.
26
const resolvedPreopens = { ...preopens };
27
for (const arg of args) {
28
- if (isAbsolute(arg) && !(arg in resolvedPreopens)) {
29
- resolvedPreopens[arg] = arg;
+ if (arg.startsWith("-")) continue;
+ const absPath = isAbsolute(arg) ? arg : resolve(arg);
30
+ if (!(absPath in resolvedPreopens)) {
31
+ resolvedPreopens[absPath] = absPath;
32
}
33
34
0 commit comments