Comparing version 1.4.5 to 1.4.6
@@ -18,5 +18,4 @@ 'use strict' | ||
if (!query.id) return resEndJSON(res, 400, 'Bad Request'); | ||
var stdout = '', stderr = '', child; | ||
if (query.exec) { | ||
exec(query.exec, function(err, stdout, stderr){ | ||
exec(query.exec, function (err, stdout, stderr) { | ||
if (err) return resEndJSON(res, 500, err); | ||
@@ -26,12 +25,11 @@ resEndJSON(res, 200, {"success":true,"id":query.id,"done":true,"data":stdout||''}); | ||
} else if (query.file) { | ||
child = spawn(query.file, JSON.parse(query.args||'[]')); | ||
child.stdout.on('data', (data) => { | ||
var stdout = ''; | ||
var child = spawn(query.file, JSON.parse(query.args||'[]')); | ||
child.stdout.on('data', function (data) { | ||
stdout += data.toString(); | ||
console.log(`stdout: ${data}`); | ||
}); | ||
child.stderr.on('data', (data) => { | ||
console.error(`stderr: ${data}`); | ||
child.stderr.on('data', function (data) { | ||
console.error('stderr: '+ data.toString()); | ||
}); | ||
child.on('close', (code) => { | ||
console.log(`child process exited with code ${code}`); | ||
child.on('close', function (code) { | ||
if (code === 0) { | ||
@@ -38,0 +36,0 @@ resEndJSON(res, 200, {"success":true,"id":query.id,"done":true,"data":stdout||''}); |
{ | ||
"name": "bfn-proxy", | ||
"version": "1.4.5", | ||
"version": "1.4.6", | ||
"description": "HTTP request proxy middleware for node.js", | ||
@@ -5,0 +5,0 @@ "author": "Blue Fidelity Inc. (https://www.bluefidelity.com/)", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
23859
442