优化结构
This commit is contained in:
@@ -43,6 +43,14 @@ func composeStreams(
|
||||
errCh <- nil
|
||||
}()
|
||||
putErr := put(ctx, destination, reader)
|
||||
// A failed destination may stop reading before the producer reaches EOF.
|
||||
// Close the pipe reader in that case so the producer's next write returns
|
||||
// instead of leaving the goroutine blocked forever.
|
||||
if putErr != nil {
|
||||
_ = reader.CloseWithError(putErr)
|
||||
} else {
|
||||
_ = reader.Close()
|
||||
}
|
||||
composeErr := <-errCh
|
||||
if putErr != nil {
|
||||
_ = remove(ctx, destination)
|
||||
|
||||
Reference in New Issue
Block a user