Skip to content

Quotes are not handled correctly when child_process.spawn() parses args #5060

Closed
@SetTrend

Description

@SetTrend
require('child_process')
    .spawn('cmd', ['/c', 'node "my test/__args_out.js" b c d e f'])
    .stderr.addListener("data", data => {console.log(data.toString());});

fails because quotes don't seem to be recognized and parsed by child_process.spawn() as delimiters for parameters with spaces:

Error: Cannot find module 'd:\Documents\VS Code\"my test\__args_out.js"'
    at Function.Module._resolveFilename (module.js:326:15)
    at Function.Module._load (module.js:277:25)
    at Function.Module.runMain (module.js:430:10)
    at startup (node.js:141:18)
    at node.js:980:3

This happens on Windows platforms. I can't tell whether the above error occurs on other platforms, too.


The above code is taken from jake source.

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