diff --git a/.gitmodules b/.gitmodules new file mode 100644 index 0000000..5c82685 --- /dev/null +++ b/.gitmodules @@ -0,0 +1,3 @@ +[submodule "process"] + path = process + url = https://git.trovadores.duckdns.org/ianmethyst/spy-camera-process.git diff --git a/index.js b/index.js index fa3103d..e4b54b5 100644 --- a/index.js +++ b/index.js @@ -41,11 +41,14 @@ app.post('/upload-photo', async (req, res) => { }; // move photo to uploads directory - const filepath = `./uploads/${photo.name}`; - photo.mv(filepath); + const filepath = `uploads/${photo.name}`; + await photo.mv(`./${filepath}`); - const python = spawnSync('python3', - ['./main.py', `${filepath}`, `${city}`, `${school}`, `${age}`]); + const python = spawnSync( + 'bash', + ['-e', './runProcess.sh', `../${filepath}`, `${city}`, `${school}`, `${age}`]); + console.log("stdout: ",python.stdout.toString('utf8')); + console.log("stderr: ",python.stderr.toString('utf8')); if (python.status === 0) { res.send({ diff --git a/process b/process new file mode 160000 index 0000000..12990ca --- /dev/null +++ b/process @@ -0,0 +1 @@ +Subproject commit 12990cac8d50b44db953d7b375e43c039029b5e7 diff --git a/runProcess.sh b/runProcess.sh new file mode 100755 index 0000000..c942ec1 --- /dev/null +++ b/runProcess.sh @@ -0,0 +1,5 @@ +#/bin/bash + +cd process +pipenv run python3 main.py "$1" "$2" "$3" "$4" +exit 0