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

Use the /q flag with cmd.exe #135

Open
zenflow opened this issue Jul 6, 2020 · 0 comments
Open

Use the /q flag with cmd.exe #135

zenflow opened this issue Jul 6, 2020 · 0 comments

Comments

@zenflow
Copy link

zenflow commented Jul 6, 2020

Is this an nodejs issue we can solve here in userland?

nodejs/node#27120 - Use the /q flag with cmd.exe in child_process.spawn()

I think it makes sense to add the flag by default here (in cross-spawn), without any option, even if it won't be done by default in Node.js child_process because it prevents a "special" Windows behavior (i.e. printing an extra line like D:\foo\bar>echo hello to the console as the initial output nodejs/node#27120 (comment)).

Node.js core needs to make it optional since some user some time might want to use this Windows-only behavior, but cross-spawn doesn't have that burden.

Execa simply prepends the /q flag to the parsed args like this:

https://github.com/sindresorhus/execa/blob/717d29d539e0bdf1666c1a4bc10fa406d996e7b3/index.js#L28-L56

	const parsed = crossSpawn._parse(file, args, options);
	file = parsed.command;
	args = parsed.args;
	options = parsed.options;
        // ... mutations to `options` ...
	if (process.platform === 'win32' && path.basename(file, '.exe') === 'cmd') {
		// #116
		args.unshift('/q');
	}
        // ... calls Node.js `child_process.spawn` with file, args, options ...

Referenced issue: sindresorhus/execa#116

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant