changed ths script to spawn in the index.js
authorOscar J. Rodriguez B <josuer08@gmail.com>
Thu, 3 Oct 2019 20:29:18 +0000 (16:29 -0400)
committerOscar J. Rodriguez B <josuer08@gmail.com>
Thu, 3 Oct 2019 20:29:18 +0000 (16:29 -0400)
src/routes/index.js

index 3e06433a467fe7452bd957341260405bf96c0fd5..70758258231c1c6092ebfaeed0b650927854249a 100644 (file)
@@ -73,11 +73,15 @@ router.get('/gettopo', (req, res) => {
 
 router.get('/startcontroller', (req, res) => {
   var sys = require('sys')
-  var exec = require('child_process').exec;
+  var exec = require('child_process').spawn;
   var child;
-  chlid = exec("cd /home/pi/ryu && ./ejecutarcontroller.sh", function(error, stdout, stderr){
-    console.log("startcontroller");
-    res.send(stdout);
+  chlid = spawn('python', ['-f','./../pypy.py']);
+
+    pyProg.stdout.on('data', function(data) {
+
+        console.log(data.toString());
+        res.write(data);
+        res.end('end');
   });
 });
 module.exports = router;