feature: Better feedback on shellAfterCommand, and mark OliveTin specific output with "OliveTin::" in logs (#403)

This commit is contained in:
James Read
2024-09-02 23:59:19 +01:00
committed by GitHub
parent d4bd7dd586
commit f8c330aae3

View File

@@ -491,7 +491,7 @@ func stepExec(req *ExecutionRequest) bool {
// The context timeout should kill the process, but let's make sure.
req.executor.Kill(req.logEntry)
req.logEntry.TimedOut = true
req.logEntry.Output += "This OliveTin action timed out after " + fmt.Sprintf("%v", req.Action.Timeout) + " seconds. If you need more time for this action, set a longer timeout. See https://docs.olivetin.app/timeout.html for more help."
req.logEntry.Output += "OliveTin::timeout - this action timed out after " + fmt.Sprintf("%v", req.Action.Timeout) + " seconds. If you need more time for this action, set a longer timeout. See https://docs.olivetin.app/timeout.html for more help."
}
req.logEntry.DatetimeFinished = time.Now()
@@ -525,17 +525,24 @@ func stepExecAfter(req *ExecutionRequest) bool {
waiterr := cmd.Wait()
req.logEntry.Output += "---\n" + stdout.String()
req.logEntry.Output += "---\n" + stderr.String()
req.logEntry.Output += "\n" + stdout.String()
req.logEntry.Output += "OliveTin::shellAfterCompleted stdout\n" + stdout.String()
req.logEntry.Output += stdout.String()
req.logEntry.Output += "OliveTin::shellAfterCompleted stderr\n" + stdout.String()
req.logEntry.Output += stderr.String()
req.logEntry.Output += "OliveTin::shellAfterCompleted errors and summary\n" + stdout.String()
appendErrorToStderr(runerr, req.logEntry)
appendErrorToStderr(waiterr, req.logEntry)
if ctx.Err() == context.DeadlineExceeded {
req.logEntry.Output += "Your shellAfterCommand command timed out."
req.logEntry.Output += "Your shellAfterCompleted command timed out."
}
req.logEntry.Output += fmt.Sprintf("Your shellAfterCommand exited with code %v", cmd.ProcessState.ExitCode())
req.logEntry.Output += fmt.Sprintf("Your shellAfterCompleted exited with code %v\n", cmd.ProcessState.ExitCode())
req.logEntry.Output += "OliveTin::shellAfterCompleted output complete\n" + stdout.String()
return true
}