@@ -340,20 +340,22 @@ func (r *Runner) run(ctx context.Context, script codersdk.WorkspaceAgentScript,
340
340
stage = proto .Timing_CRON
341
341
}
342
342
343
- _ , err = r .scriptCompleted (ctx , & proto.WorkspaceAgentScriptCompletedRequest {
344
- Timing : & proto.Timing {
345
- ScriptId : script .ID [:],
346
- DisplayName : script .DisplayName ,
347
- Start : timestamppb .New (start ),
348
- End : timestamppb .New (end ),
349
- ExitCode : int32 (exitCode ),
350
- Stage : stage ,
351
- TimedOut : errors .Is (err , ErrTimeout ),
352
- },
353
- })
343
+ if r .scriptCompleted != nil {
344
+ _ , err = r .scriptCompleted (ctx , & proto.WorkspaceAgentScriptCompletedRequest {
345
+ Timing : & proto.Timing {
346
+ ScriptId : script .ID [:],
347
+ DisplayName : script .DisplayName ,
348
+ Start : timestamppb .New (start ),
349
+ End : timestamppb .New (end ),
350
+ ExitCode : int32 (exitCode ),
351
+ Stage : stage ,
352
+ TimedOut : errors .Is (err , ErrTimeout ),
353
+ },
354
+ })
354
355
355
- if err != nil {
356
- logger .Error (ctx , fmt .Sprintf ("reporting script completed: %s" , err .Error ()))
356
+ if err != nil {
357
+ logger .Error (ctx , fmt .Sprintf ("reporting script completed: %s" , err .Error ()))
358
+ }
357
359
}
358
360
}()
359
361
0 commit comments