(directory, client, sessionID)
| 1436 | |
| 1437 | if (job.postrunCommand) { |
| 1438 | if (job.safe && dangerousShell(job.postrunCommand)) await appendLoopLog(directory, "postrun-blocked", { sessionID, job: job.name || job.id, command: job.postrunCommand }) |
| 1439 | else { |
| 1440 | const postrun = await runShellCommand(job.postrunCommand, directory, job.timeoutMs || 300_000) |
| 1441 | job.lastPostrunCode = postrun.code |
| 1442 | job.lastPostrunAt = now() |
| 1443 | if (postrun.code !== 0) { |
| 1444 | job.failureCount = (job.failureCount || 0) + 1 |
| 1445 | job.lastPostrunFailure = (job.postrunCommand + "\nexit=" + postrun.code + "\n" + postrun.stdout + "\n" + postrun.stderr).slice(0, 4000) |
| 1446 | if (job.maxFailures > 0 && job.failureCount >= job.maxFailures) { |
| 1447 | job.paused = true |
| 1448 | await notifyJob(directory, job, "postrun_failed") |
| 1449 | } |
| 1450 | } |
| 1451 | await appendLoopLog(directory, "postrun", { sessionID, job: job.name || job.id, command: job.postrunCommand, code: postrun.code }) |
| 1452 | } |
| 1453 | } |
no test coverage detected