Search code examples
javascriptnode.jschild-processextendscript

nodejs execsync command failed


I am trying to run a execSync file:

try {
    const child_process = require("child_process")
    child_process.execSync('"C:/Program Files/Adobe/Adobe Photoshop CC 2019/Photoshop.exe" Z:/myfile.jsx', (err, stdout, stderr) => {
    if (err) {
        console.log("error here");
    }
})
    .on('close', function (code, signal) {console.log('go to next step')})
} catch (err) {
    err.stdout;
    err.stderr;
    err.pid;
    err.signal;
    err.status;
}

The script ran but gave me exit code of 1:

Error: Command failed: "C:/Program Files/Adobe/Adobe Photoshop CC 2019/Photoshop.exe" Z:/myfile.jsx

How could I get rid of this.


Solution

  • I finally solved it by writing a photoshop exit code inside the jsx file and it closed the photoshop and given me a success code