I'm trying to trigger one JS file from Electron. If I try the command node test.js in the terminal, it's working fine. If I try the same thing in Electron, I'm getting an error Uncaught Error: spawn node test.js ENOENT
. Can you correct me if I'm on the wrong path?
var spawn = require('child_process').spawn;
var executeSpawn = spawn('node test.js',{
cwd: process.resourcesPath+'/app/test.js'});
executeSpawn.stdout.on('data',function(data){
console.log(`data:${data}`);
});
executeSpawn.stderr.on('data',function(data){
console.log("data:",data);
});
executeSpawn.on('close',function(ev){
console.log("ev",ev);
});
Thanks in advance.