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#spawn breaks backward compatibility in node v4.8.0 #12117

Closed
naugtur opened this issue Mar 29, 2017 · 2 comments
Closed

child_process#spawn breaks backward compatibility in node v4.8.0 #12117

naugtur opened this issue Mar 29, 2017 · 2 comments
Labels
child_process Issues and PRs related to the child_process subsystem.

Comments

@naugtur
Copy link

naugtur commented Mar 29, 2017

  • Version: v4.8.0 and up
  • Platform: Linux 4.4.0-64-generic Update README.md #85-Ubuntu SMP Mon Feb 20 11:50:30 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
  • Subsystem: child_process

Arguments array to spawn behaves differently between node versions up to 4.7.3 and node 4.8.0+

PoC - works as expected only in old versions. Nev node will pass 'install --production' as arguments to bash

const childProcess = require('child_process');
const spawn = childProcess.spawn;
const defaultOptions = {
  env: {},
  shell: "/bin/bash",
  stdio: [0, 1, 2]
};

const p = childProcess.spawn("/bin/bash", [ '-c', 'npm install --production' ], defaultOptions)

p.on('exit', exitCode => {
    console.log(exitCode);
});

The PoC is a short version of spawn-shell parro-it/spawn-shell#1

@bnoordhuis bnoordhuis added child_process Issues and PRs related to the child_process subsystem. v4.x labels Mar 29, 2017
@bnoordhuis
Copy link
Member

See PR #4598 and commit 5824522. The reason you see different behavior is because you pass a .shell property in options, something that wasn't supported (and was a no-op) before.

@naugtur
Copy link
Author

naugtur commented Mar 29, 2017

Thanks, I just found that out. It makes this an issue with spawn-shell package and semver on node is correct.

@naugtur naugtur closed this as completed Mar 29, 2017
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.
Projects
None yet
Development

No branches or pull requests

2 participants