Tit*_*tan 5 spawn node.js node-webkit
我正试图在我的Windows文件系统上的其他地方启动.exe.
spawn = require('child_process').spawn;
game.process = spawn(path.join(config.values.armaPath, 'arma3.exe'), {
detached: true
});
Run Code Online (Sandbox Code Playgroud)
我把它包装在try/catch中,我得到的错误没有帮助:
Error {code: "UNKNOWN", errno: "UNKNOWN", syscall: "spawn", stack: (...), message: "spawn UNKNOWN"}code: "UNKNOWN"errno: "UNKNOWN"message: "spawn UNKNOWN"
Run Code Online (Sandbox Code Playgroud)
我已经确认.exe的path.join是正确的.
我也试过了
game.process.stdout.on('error'...
Run Code Online (Sandbox Code Playgroud)
但那永远不会开火.
编辑,我也尝试了另一种方法:
var child = execFile(path.join(config.values.armaPath, 'arma3.exe'),
function(error,stdout,stderr) {
if (error) {
console.log(error.stack);
console.log('Error code: '+ error.code);
console.log('Signal received: '+ error.signal);
}
console.log('Child Process stdout: '+ stdout);
console.log('Child Process stderr: '+ stderr);
}
);
Run Code Online (Sandbox Code Playgroud)
但是这只是相同代码的错误,就像在调用spawn函数的回调之前抛出了try/catch块错误.
有趣的是,我尝试在同一目录中调用.exe,它确实有效......
| 归档时间: |
|
| 查看次数: |
2081 次 |
| 最近记录: |