Skip to content

Commit

Permalink
Windows: can not run scripts starting with relative path #1729 (#2617)
Browse files Browse the repository at this point in the history
Enable the fixCmdWinSlashes class for the lifecycle scripts to clean up the
Windows run scripts starting with a relative path
  • Loading branch information
davidwickman authored and bestander committed Feb 14, 2017
1 parent 15369cb commit 51b4d0d
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
4 changes: 1 addition & 3 deletions src/cli/commands/run.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {MessageError} from '../../errors.js';
import {registries} from '../../resolvers/index.js';
import * as fs from '../../util/fs.js';
import map from '../../util/map.js';
import {fixCmdWinSlashes} from '../../util/fix-cmd-win-slashes.js';

const leven = require('leven');
const path = require('path');
Expand Down Expand Up @@ -70,8 +69,7 @@ export async function run(
for (const action of actions) {
const cmd = scripts[action];
if (cmd) {
const isWin = 'win32' === process.platform;
cmds.push([action, isWin ? fixCmdWinSlashes(cmd) : cmd]);
cmds.push([action, cmd]);
}
}

Expand Down
4 changes: 4 additions & 0 deletions src/util/execute-lifecycle-script.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {MessageError, SpawnError} from '../errors.js';
import * as constants from '../constants.js';
import * as child from './child.js';
import {registries} from '../resolvers/index.js';
import {fixCmdWinSlashes} from './fix-cmd-win-slashes.js';

const path = require('path');

Expand Down Expand Up @@ -141,6 +142,9 @@ export async function executeLifecycleScript(
// c - Run Command and then terminate
shFlag = '/d /s /c';

// handle windows run scripts starting with a relative path
cmd = fixCmdWinSlashes(cmd);

// handle quotes properly in windows environments - https://github.com/nodejs/node/issues/5060
conf.windowsVerbatimArguments = true;
}
Expand Down

0 comments on commit 51b4d0d

Please sign in to comment.