简体   繁体   中英

Trying to start .exe application from Node.js

I'm trying to launch mupen64plus from Node.js like so:

var exec = require('child_process').execFile;

var child = exec('mupen64plus.exe --fullscreen "../roms/some-homebrew.z64"', function(err, stdout, stderr) {
  console.log(err, stdout, stderr);
});

Which give the output of:

{ [Error: spawn ENOENT] code: 'ENOENT', errno: 'ENOENT', syscall: 'spawn' } '' ''

I know it is running the application, because when I remove the "../roms/some-homebrew.z64" section, I get the regular mupen64plus output saying it cannot find a ROM to load.

I assume the error has to do with spawn ing a new window, or application, to actually run this.

Am I doing the right thing to spawn this application? If so, how can I get further information on what's happening?

Update: This code works!

var exec = require('child_process').spawn;

var child = exec(__dirname + '/relative-path/to/mupen64plus.exe', ['--fullscreen', __dirname + '/relative-path/to/home-brew.z64']);

Remove the double quotes around the ROM path. Given the description you've given about the troubleshooting you've done, the issue looks to be with the format you're passing the argument in.

There shouldn't be any issues with opening a fullscreen application and there are various examples that utilise exec to open fullscreen chrome windows.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM