Skip to content

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

@naugtur

Description

@naugtur
  • 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

Metadata

Metadata

Assignees

No one assigned

    Labels

    child_processIssues and PRs related to the child_process subsystem.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions