Skip to content

Should overwriting child_process.execFile result in changed behaviour of child_process.exec? #15076

Description

@Ginden
node -e "child_process.execFile = null; child_process.exec('cat package.json')"
    child_process.js:138
      return exports.execFile(opts.file,
    TypeError: exports.execFile is not a function
        at Object.exports.exec (child_process.js:138:18)

I couldn't find in documentation why child_process behave this way (but it behaves like that for at least four years).

Relevant line https://github.com/nodejs/node/blob/58831b2/lib/child_process.js#L136

Activity

  1. changed the title [-]Why overwriting child_process.execFile will result in changed behaviour of child_process.exec[/-] [+]Should overwriting child_process.execFile result in changed behaviour of child_process.exec?[/+] on Aug 29, 2017
  2. added
    child_processIssues and PRs related to the child_process subsystem.
    on Aug 29, 2017
  3. bnoordhuis commented on Sep 11, 2017

    @bnoordhuis
    Member

    I don't think we consider this a bug; I'll interpret the fact that this issue didn't generate discussion as tacit approval of that. If you monkey-patch node.js itself, unexpected things may happen.

    I'll close this out, reopen if that is a mistake.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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