Closed
Description
- Version: v6.5.0
- Platform: Windows 10 (x64)
- Subsystem: child_process
let cp = require('child_process');
let util = require('util');
try {
cp.execFileSync('SomeTool.exe')
} catch (err) {
console.log('err', util.inspect(err));
}
outputs
err { Error: spawnSync SomeTool.exe UNKNOWN
at exports._errnoException (util.js:1026:11)
at spawnSync (child_process.js:461:20)
at Object.execFileSync (child_process.js:498:13)
at repl:2:4
at sigintHandlersWrap (vm.js:22:35)
at sigintHandlersWrap (vm.js:96:12)
at ContextifyScript.Script.runInThisContext (vm.js:21:12)
at REPLServer.defaultEval (repl.js:313:29)
at bound (domain.js:280:14)
at REPLServer.runBound [as eval] (domain.js:293:12)
code: 'UNKNOWN',
errno: 'UNKNOWN',
...
}
spawn generates the same error.
Obviously it would be better if this error was returned through the callback but I would also love to have a proper error code to react to the situation.
Not sure how execFile and spawn are implemented but it should be possible to report a proper errorcode as CreateProcess generates errorcode 740 if elevation is required.