mirror of
https://github.com/taobataoma/meanTorrent.git
synced 2026-02-28 09:10:59 +01:00
fix(systems): fixed shell command exit code issue
This commit is contained in:
@@ -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
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user