Skip to content

Conversation

@DiscreteTom
Copy link

@DiscreteTom DiscreteTom commented Nov 13, 2023

With this feature, users can specify $PATH to locate the ripgrep bin.

import { ripGrep as rg } from 'ripgrep-js';
import * as path from "path";

const rgFolderPath = 'xxx';

rg('path/to/search', {
  string: 'xxx',
  env: {
    ...process.env,
    // https://github.com/nodejs/node/issues/34667#issuecomment-672863358
    [Object.keys(process.env).find((x) => x.toUpperCase() === "PATH")!]:
      process.env.PATH + path.delimiter + rgFolderPath,
  }
})

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant