Skip to content

Commit

Permalink
Add missing span.End()
Browse files Browse the repository at this point in the history
Previous commit made clear that `(*externalProcess).Wait()` was
missing a call to `span.End()`.

Signed-off-by: Albin Kerouanton <albinker@gmail.com>
  • Loading branch information
akerouanton committed May 6, 2024
1 parent adb4f70 commit b6f4026
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion internal/guest/runtime/hcsv2/process.go
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,7 @@ func (ep *externalProcess) ResizeConsole(_ context.Context, height, width uint16
}

func (ep *externalProcess) Wait() (<-chan int, chan<- bool) {
otelutil.StartSpan(context.Background(), "opengcs::externalProcess::Wait", trace.WithAttributes(
_, span := otelutil.StartSpan(context.Background(), "opengcs::externalProcess::Wait", trace.WithAttributes(
attribute.Int64("pid", int64(ep.cmd.Process.Pid))))

exitCodeChan := make(chan int, 1)
Expand All @@ -305,8 +305,10 @@ func (ep *externalProcess) Wait() (<-chan int, chan<- bool) {
ep.removeOnce.Do(func() {
ep.remove(ep.cmd.Process.Pid)
})
span.End()
case <-doneChan:
// Caller closed early, do nothing.
span.End()
}
}()
return exitCodeChan, doneChan
Expand Down

0 comments on commit b6f4026

Please sign in to comment.