Restore cancellation checks before report delivery
This commit is contained in:
@@ -117,22 +117,17 @@ func runConfigSources[I, S any](invocation commandkit.Invocation, plan *configOp
|
||||
if err := invocation.Context.Err(); err != nil {
|
||||
return configFailure("Configuration source listing was canceled.", acquired.Explanation, err)
|
||||
}
|
||||
err := reporter.RenderOutput(func(writer io.Writer) error {
|
||||
return renderPreparedConfigReport(invocation, acquired.Explanation, func() ([]byte, error) {
|
||||
var report bytes.Buffer
|
||||
if plan.format == "yaml" {
|
||||
if err := encodeYAML(&report, document); err != nil {
|
||||
return err
|
||||
return nil, err
|
||||
}
|
||||
} else {
|
||||
writeSourceReportText(&report, document)
|
||||
}
|
||||
_, err := writer.Write(report.Bytes())
|
||||
return err
|
||||
return report.Bytes(), nil
|
||||
})
|
||||
if err != nil && invocation.Context.Err() != nil {
|
||||
return configFailure("Configuration source listing was canceled.", acquired.Explanation, invocation.Context.Err())
|
||||
}
|
||||
return commandkit.Success()
|
||||
}
|
||||
|
||||
func writeSourceReportText(writer *bytes.Buffer, document sourceReport) {
|
||||
|
||||
Reference in New Issue
Block a user