im using NWJS to create a simple desktop app. I need to connect console c++ app when I do a click event in a button on html5. I heard it's possible using 'child_process' internal module from Nodejs. I didn't get to exec the exe file when I click in the button.
I have next code:
const exec = require('child_process').execFile;
var cmd = 'Test.exe 1';
exec(cmd, function(error, stdout, stderr) {
// command output is in stdout
console.log('stdout:', stdout);
console.log('stderr:', stderr);
if (error !== null) {
console.log('exec error:', error);
}
});
The .exe file has a input parameter (a number) and it returns a simple text with the introduced number. Anyone can help me?
Thanks!