while trying to execute following command using exec
java -cp %SIKULI_HOME%\sikuli-script.jar org.python.util.jython E:\automation.sikuli\automation.py "a,b,c"
am getting following error
var exec = require('child_process').execFile;
postreq.params prints values as a,b,c.i want to pass this with \automation.py "a,b,c" i dodnt know how to pass with below one
exec('java -cp %SIKULI_HOME%\sikuli-script.jar org.python.util.jython E:\automation.sikuli\automation.py postreq.params', function (err, data) {
console.log(err);
console.log(data);
console.log("Sikuli execution started")
// res.end(data);
});
error
{ [Error: spawn ENOENT] code: 'ENOENT', errno: 'ENOENT', syscall: 'spawn' }
below command is working properly using cmd
java -cp %SIKULI_HOME%\sikuli-script.jar org.python.util.jython E:\automation.sikuli\automation.py "a,b,c"
The way you explain your problem, postreq.params
seems to be a JavaScript variable. If so, this is what you should exec:
var exec = require("child_process").exec;
exec('java -cp %SIKULI_HOME%\sikuli-script.jar org.python.util.jython E:\automation.sikuli\automation.py "' + postreq.params + '"', function (err, data) {
I'm not a Windows guy so I'm not positive that %SIKULI_HOME%
will be expanded like you want. If not, then using process.env.HOMEPATH
like Phoenix suggested in a comment should do the trick:
exec('java -cp ' + proces.env.HOMEPATH + '\sikuli-script.jar org.python.util.jython E:\automation.sikuli\automation.py "' + postreq.params + '"', function (err, data) {