diff --git a/index.js b/index.js index 17e774b..785fd64 100644 --- a/index.js +++ b/index.js @@ -91,12 +91,16 @@ function fromWritable(stream) { // NOTE: The use of `var` is intentional, to make hoisting possible here; otherwise we'd have a broken cyclical reference var writable = wireUpWritableInterface(stream, { onEnd: () => { + debugWritable(`Underlying stream has reported a close event (upstreamHasEnded = ${upstreamHasEnded})`); + if (!upstreamHasEnded) { + debugWritable(`Issuing happy abort on converted stream`); convertedStream.abort(true, mostRecentSource); } }, onError: (error) => { // Make sure we notify the pipeline, if any, by passing in the most recent source stream that we've seen. + debugWritable(`Issuing error abort on converted stream due to: ${error.message}`); convertedStream.abort(error, mostRecentSource); } });