Skip to content

Does not return error ENOENT when program not found on Windows #16

@Glavin001

Description

@Glavin001

Thanks for developing cross-spawn! It is disappointing that Node.js does not support this out of the box, and your package provides something of great value to those developing packages that require support for Windows.


Normally, when spawn cannot find the program to be executed it returns an error ENOENT. However, since this command is wrapped in cmd.exe it no longer does that, and instead returns an error generated by cmd.exe and has returnCode=1 and stderr in the form “command” is not recognized as an internal or external command, operable program or batch file.

My workaround was to check if returnCode equals 1 (non-zero) and if the stderr message contains similar text, such as the part: is not recognized as an internal or external command.

I am using it here for my package Atom Beautify: Glavin001/atom-beautify@57ffe75

Please let me know what you think, and if I should submit a Pull Request with the workaround I described above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions