Skip to content

child_process.spawn adds flags that might cause non-native shells to fail on windows #19947

Closed
@idanpa

Description

@idanpa
  • Version: 8.11.1
  • Platform: Windows 10 64 bit
  • Subsystem: child_process

On Windows, when child_process.spawn is given the optional shell parameter (#4598) it makes an assumption that the shell would understand the /c /s flags (cmd.exe or powershell).
This limits the option to use bash (using WSL) on windows.
Can by bypassed by:

args = ["\"", cmd].concat(args, "\"");
currentSync = child.spawn("bash -c", args, {stdio: 'pipe', shell: "cmd.exe"});

But would be nice to have a better solution.

Thanks,
Idan

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.wslIssues and PRs related to the Windows Subsystem for Linux.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions