Skip to content

Commit 88008aa

Browse files
committed
Update comment and error message if flushing pipe fails
Signed-off-by: John Eckersberg <[email protected]>
1 parent 4abee0f commit 88008aa

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

ostree-ext/src/generic_decompress.rs

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -94,13 +94,17 @@ impl Drop for Decompressor {
9494
return;
9595
}
9696

97-
// We really should not get here; users are required to call
98-
// `finish()` to clean up the stream. But we'll give
97+
// Ideally we should not get here; users should call
98+
// `finish()` to clean up the stream. But in reality there's
99+
// codepaths that can and will short-circuit error out while
100+
// processing the stream, and the Decompressor will get
101+
// dropped before it's finished in those cases. We'll give
99102
// best-effort to clean things up nonetheless. If things go
100103
// wrong, then panic, because we're in a bad state and it's
101104
// likely that we end up with a broken pipe error or a
102105
// deadlock.
103-
self._finish().expect("Decompressor::finish MUST be called")
106+
self._finish()
107+
.expect("Failed to flush pipe while dropping Decompressor")
104108
}
105109
}
106110

0 commit comments

Comments
 (0)