Skip to content

Commit

Permalink
feat(utils/exec): doesn't reset paths; doesn't add paths unless optio…
Browse files Browse the repository at this point in the history
…ns.cwd exists
  • Loading branch information
rafamel committed May 8, 2019
1 parent 5e3c765 commit fe9da49
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/utils/exec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,7 @@ import logger from '~/utils/logger';
import join from 'command-join';
import { IExecOptions } from '~/types';
import { absolute } from './file';
import manager, { EnvManager } from '~/utils/env-manager';
import path from 'path';
import EnvManager from '~/utils/env-manager';
import getBinPaths from './paths';
import guardian from './guardian';

Expand All @@ -25,14 +24,9 @@ export default async function exec(
? absolute({ path: options.cwd, cwd: process.cwd() })
: process.cwd();

if (path.relative(cwd, process.cwd())) {
local.assign({ [local.path]: manager.purePaths });
local.addPaths(await getBinPaths(cwd));
}
if (options.env) local.assign(options.env);
if (options.paths && options.paths.length) {
local.addPaths(options.paths);
}
// If a cwd is passed in options, we'll add in bin paths
if (options.cwd) local.addPaths(await getBinPaths(cwd));

const opts: SpawnOptions | ForkOptions = {
cwd,
Expand Down

0 comments on commit fe9da49

Please sign in to comment.