Skip to content

child_process,Windows: deprecate explicit use of cmd.exe #14157

Description

@refack
  • Version: *
  • Platform: Windows
  • Subsystem: child_process

https://github.com/nodejs/node/blob/master/lib/child_process.js#L444 has a fallback to use cmd.exe in case process.env.ComSpec is falsy.
This is redundant, fragile, and generally covers-up an invalid state (%ComSpec% should always be defined and point to a valid shell executable).
This code path should be deprecated according to the guide at https://github.com/nodejs/node/blob/master/COLLABORATOR_GUIDE.md#deprecations
and https://github.com/nodejs/node/blob/master/doc/api/deprecations.md

Ref: #14149 (comment)

Activity

  1. added
    child_processIssues and PRs related to the child_process subsystem.
    windowsIssues and PRs related to the Windows platform.
    on Jul 10, 2017
  2. cjihrig commented on Jul 10, 2017

    @cjihrig
    Contributor

    @nodejs/platform-windows

  3. tniessen commented on Jul 10, 2017

    @tniessen
    Member

    Technically, this is correct, and I don't see a chance of breaking code. Some will probably break due to custom child process environments, but that's what deprecation is for.

  4. joaocgreis commented on Jul 10, 2017

    @joaocgreis
    Member

    So, for users, what this is effectively deprecating is using an environment without %COMSPEC%.

    I'm -0 on this. While situations without %COMSPEC% are probably quite messed up already, cmd.exe is a valid fallback and I don't see a pressing reason for deprecating, how this actually translates as an improvement for node.

    But discussion is always welcome!

  5. refack commented on Jul 11, 2017

    @refack
    ContributorAuthor

    I'm -0 on this. While situations without %COMSPEC% are probably quite messed up already, cmd.exe is a valid fallback and I don't see a pressing reason for deprecating, how this actually translates as an improvement for node.

    But discussion is always welcome!

    1. I opened this as an issue rather than a PR mainly for discussion 😃
    2. Literal command strings IMHO are just bad and need a very good reason to exist.
    3. In this case it doesn't "solve", just improves the situation by ϵ%. Just as the environment could be missing %COMSPEC%, it could be missing %PATH% (or %WINDIR% so %WINDIR%\system32\cmd.exe isn't any better), and also the system could be missing cmd.exe completely. So if we're just patching over a messed up situation with a only a slightly less messy fix, why bother 🤷‍♂️
    4. In general I'm just +0.5 on this whole thing, I just don't like literal command strings in the code
  6. gireeshpunathil commented on May 19, 2018

    @gireeshpunathil
    Member

    Closing as it is inactive for around an year, feel free to re-open if there is anything outstanding.

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.windowsIssues and PRs related to the Windows platform.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions