Skip to content

Commit

Permalink
feat(core): allows relative paths as cwd on exec
Browse files Browse the repository at this point in the history
  • Loading branch information
rafamel committed Apr 26, 2019
1 parent 758ad8d commit a294f8b
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions src/core/index.ts
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
import path from 'path';
import _cache from '~/utils/cache';
import options, { raw } from './options';
import { getSelfPaths, getRootPaths } from './paths';
Expand Down Expand Up @@ -84,10 +85,13 @@ const core = {
fork: boolean,
opts: IExecOptions = {}
): Promise<void> {
const paths = await core.paths();
const cwd = opts.cwd
? opts.cwd
: await core.paths().then((paths) => paths.directory);
const bin = opts.cwd ? await getBin(opts.cwd) : await core.bin();
? path.isAbsolute(opts.cwd)
? opts.cwd
: path.join(paths.directory, opts.cwd)
: paths.directory;
const bin = opts.cwd ? await getBin(cwd) : await core.bin();
const env = opts.env
? Object.assign({}, await core.get('env'), opts.env)
: await core.get('env');
Expand Down

0 comments on commit a294f8b

Please sign in to comment.