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

child_process normalizeSpawnArguments doesn't handle spaced arguments #31068

Closed
homobel opened this issue Dec 23, 2019 · 6 comments
Closed

child_process normalizeSpawnArguments doesn't handle spaced arguments #31068

homobel opened this issue Dec 23, 2019 · 6 comments
Labels
child_process Issues and PRs related to the child_process subsystem. windows Issues and PRs related to the Windows platform.

Comments

@homobel
Copy link

homobel commented Dec 23, 2019

v13.5.0
Windows 10 64

Reproduce:
npx gulp "full dev" =>
(normalizeSpawnArguments, args = ['full dev'] ) const command = [file].concat(args).join(' '); =>
"path/to/gulp.cmd full dev"

@Trott Trott added windows Issues and PRs related to the Windows platform. child_process Issues and PRs related to the child_process subsystem. labels Dec 28, 2019
@Trott
Copy link
Member

Trott commented Dec 28, 2019

Can you provide a clearer statement of how to reproduce? Is there a Gulpfile or something that one needs to reproduce this problem?

@homobel
Copy link
Author

homobel commented Dec 28, 2019

Sorry, wanted to show real world example. Here is the minimal one: child_process.zip
Try 'node b'. It will log:

0) Hello
1) world

whereas I would expect rather
0) Hello world

@Trott
Copy link
Member

Trott commented Dec 29, 2019

Thanks!

For people who don't want to download anything (or in case the link becomes stale at some point):

a.js:

const args = process.argv.slice(2);


args.forEach((arg, i) => console.log(`${i}) ${arg}`));

b.js:

const { spawn } = require('child_process');

const a = spawn('node', [__dirname + '/a.js', 'Hello world'], {shell: true});

a.stdout.on('data', data => {
	console.log(data.toString());
});

@Trott
Copy link
Member

Trott commented Dec 29, 2019

@nodejs/child_process

@richardlau
Copy link
Member

This looks like #29532 which has an open pull request (#29576) with no reviews.

@jasnell
Copy link
Member

jasnell commented Jun 25, 2020

Closing as a duplicate of #29532

@jasnell jasnell closed this as completed Jun 25, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
child_process Issues and PRs related to the child_process subsystem. windows Issues and PRs related to the Windows platform.
Projects
None yet
Development

No branches or pull requests

4 participants