From 6c08851f91e28406c041abb07f3b1905ab62aa53 Mon Sep 17 00:00:00 2001 From: OldHawk Date: Sat, 27 Jan 2018 17:21:54 +0800 Subject: [PATCH] fix(systems): fixed shell command exit code issue --- .../server/controllers/systems.server.controller.js | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/modules/systems/server/controllers/systems.server.controller.js b/modules/systems/server/controllers/systems.server.controller.js index b963bcb9..66f5d92a 100644 --- a/modules/systems/server/controllers/systems.server.controller.js +++ b/modules/systems/server/controllers/systems.server.controller.js @@ -140,14 +140,17 @@ exports.setSystemConfigContent = function (req, res) { exports.shellCommand = function (req, res) { if (req.user.isAdmin) { shell.exec(req.body.command, function (code, stdout, stderr) { - if (stderr) { + if (code !== 0) { return res.status(422).send({ code: code, + stdout: stdout, stderr: stderr }); } else { res.json({ - stdout: stdout + code: code, + stdout: stdout, + stderr: stderr }); } });