I'm using exec library to call R-script from node js express. Below is my code :
var exec = require("child_process").exec;
var param1 = some url;
var param2 = "hello";
var param3 = "world"
exec('Rscript pathtoscript/myScript.R"+" "+param1+" "+param2 , function(error, stdout, stderr) {
if (error) {
console.log(error);
res.send(error);
}
else if (stderr) {
console.log(stderr);
res.send(stderr);
}
else if (stdout) {
console.log("RAN SUCCESSFULLY");
res.json(stdout);
}
});
In the above code, if I pass only param2 and param3 the r script is able to identify it. But when I pass url, only some part of url is is getting identified as URL and rest is not (may be its long). Please suggest. Thanks