Răsfoiți Sursa

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

James Read 1 an în urmă
părinte
comite
f8c330aae3
1 a modificat fișierele cu 12 adăugiri și 5 ștergeri
  1. 12 5
      internal/executor/executor.go

+ 12 - 5
internal/executor/executor.go

@@ -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
 }