Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Add localDir option to specify location of locally installed binaries (
  • Loading branch information
acburdine authored and sindresorhus committed Jun 9, 2017
1 parent e370117 commit 0f8f7a3
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
3 changes: 2 additions & 1 deletion index.js
Expand Up @@ -37,6 +37,7 @@ function handleArgs(cmd, args, opts) {
maxBuffer: TEN_MEGABYTES,
stripEof: true,
preferLocal: true,
localDir: parsed.options.cwd || process.cwd(),
encoding: 'utf8',
reject: true,
cleanup: true
Expand All @@ -45,7 +46,7 @@ function handleArgs(cmd, args, opts) {
opts.stdio = stdio(opts);

if (opts.preferLocal) {
opts.env = npmRunPath.env(opts);
opts.env = npmRunPath.env(Object.assign({}, opts, {cwd: opts.localDir}));
}

return {
Expand Down
7 changes: 7 additions & 0 deletions readme.md
Expand Up @@ -176,6 +176,13 @@ Default: `true`
Prefer locally installed binaries when looking for a binary to execute.<br>
If you `$ npm install foo`, you can then `execa('foo')`.

#### localDir

Type: `string`<br>
Default: `process.cwd()`

Preferred path to find locally installed binaries in (use with `preferLocal`).

#### input

Type: `string` `Buffer` `stream.Readable`
Expand Down

0 comments on commit 0f8f7a3

Please sign in to comment.