Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

run one npx command at once on windows #432

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 18 additions & 7 deletions src/get-start-and-end-commands.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ const rimraf = promisify(require('rimraf'));
const cpr = path.resolve(path.dirname(require.resolve('cpr')), '../bin/cpr');
const mutatePackageJson = require('./mutate-package-json');
const semver = require('semver');
const os = require('os');

module.exports = async function getStartAndEndCommands({
cwd,
Expand All @@ -31,13 +32,23 @@ module.exports = async function getStartAndEndCommands({
});
}

let [
startCommand,
endCommand
] = await Promise.all([
reset || init ? null : _prepareCommand(startOptions),
_prepareCommand(endOptions)
]);
let startCommand;
let endCommand;

if (os.platform() === 'win32') {
// running two npx commands in parallel on Windows causes it to break the npx cache
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do you know if there's any way to get a failing test for this?

// folders and throw strange permissions errors. We need to run them in series
startCommand = await reset || init ? null : _prepareCommand(startOptions);
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you put these in helper functions, so in both cases we just have prepareStart() and prepareEnd()?

endCommand = await _prepareCommand(endOptions);
} else {
[
startCommand,
endCommand
] = await Promise.all([
reset || init ? null : _prepareCommand(startOptions),
_prepareCommand(endOptions)
]);
}

return {
startCommand,
Expand Down