From dbf58d4a68b7e47ead6f07d5cbfaf0cc9c91eb53 Mon Sep 17 00:00:00 2001 From: "Oscar J. Rodriguez B" Date: Thu, 3 Oct 2019 16:29:18 -0400 Subject: [PATCH] changed ths script to spawn in the index.js --- src/routes/index.js | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/routes/index.js b/src/routes/index.js index 3e06433..7075825 100644 --- a/src/routes/index.js +++ b/src/routes/index.js @@ -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; -- 2.25.1