piping errors to stderr when timeout exceeded

This commit is contained in:
Martin McKeaveney 2021-05-27 11:47:02 +01:00
parent 7c4ec2f23a
commit 5be2182fef
1 changed files with 8 additions and 1 deletions

View File

@ -42,7 +42,14 @@ module.exports.run = async function ({ inputs, context }) {
try {
const command = processStringSync(inputs.code, context)
const stdout = execSync(command, { timeout: 1000 })
let stdout
try {
stdout = execSync(command, { timeout: 500 })
} catch (err) {
stdout = err.message
}
return {
stdout,
}