Skip to content

Commit

Permalink
Adjust logging, also log stdout if error occurs
Browse files Browse the repository at this point in the history
  • Loading branch information
stefandesu committed May 15, 2023
1 parent f0c39bb commit 32c867e
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions index.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,14 @@ app.post("/", (req, res) => {
}
}
command += `cd ${match.path} && ${match.command}`
log(`${command}`)
log(`Command running: ${command}`)
exec(command, (error, stdout) => {
if (error) {
log(error.message, { level: "error" })
stdout && log(stdout, { level: "all" })
error.message && log(error.message, { level: "error" })
} else {
log(stdout, { level: "all" })
stdout && log(stdout, { level: "all" })
log("Command succeeded.")
}
})
}
Expand Down

0 comments on commit 32c867e

Please sign in to comment.