Skip to content

execSync crash on Windows with invalid paths #19

@justintaylor-dev

Description

@justintaylor-dev

Any invalid path with an exe extension will cause PS to show an error Uncaught class std::runtime_error while executing UXP TaskQueue item: Failed to create process and then PS itself will immediately crash.

Code to repro:

const cmdCrash =`anyInvalidPath.exe`;
(await require('bolt-uxp-hybrid.uxpaddon')).execSync(cmdCrash)

If the string doesn't end in ".exe", it will reject the command with a normal error message and PS will not crash.

Also, if I correctly point to a valid command line exe like ExifTool, I am getting crashes with strings that work in Terminal.

But I can run simple non-executable commands like:

const cmd1=`set n1=100 && set n2=200 && set /A sum=n1+n2`;
(await require('bolt-uxp-hybrid.uxpaddon')).execSync(cmd1) // returns 300

As a bonus, it would be great to have Bolt return the console output for the last command / all commands and the exit code.

On MacOS, you can wrap your command in a final echo to return JSON with the exit code and the terminal output of the last command.

On Windows, it's trickier as the return string includes all commands in the same string, not just the last one.

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