|
|
@ -66,20 +66,22 @@ module.exports = function simpleSinkStream(_options) {
|
|
|
|
return attemptRead();
|
|
|
|
return attemptRead();
|
|
|
|
}).catch(isEndOfStream, (error) => {
|
|
|
|
}).catch(isEndOfStream, (error) => {
|
|
|
|
/* Don't attempt to do another read, we're done. */
|
|
|
|
/* Don't attempt to do another read, we're done. */
|
|
|
|
if (!onEndCalled && onEnd != null) {
|
|
|
|
return Promise.try(() => {
|
|
|
|
onEndCalled = true;
|
|
|
|
if (!onEndCalled && onEnd != null) {
|
|
|
|
|
|
|
|
onEndCalled = true;
|
|
|
|
|
|
|
|
|
|
|
|
return Promise.try(() => {
|
|
|
|
return Promise.try(() => {
|
|
|
|
return onEnd();
|
|
|
|
return onEnd();
|
|
|
|
}).then((result) => {
|
|
|
|
}).then((result) => {
|
|
|
|
if (result !== undefined) {
|
|
|
|
if (result !== undefined) {
|
|
|
|
resultBuffer.push(result);
|
|
|
|
resultBuffer.push(result);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
});
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}).then(() => {
|
|
|
|
|
|
|
|
return resultBuffer.maybeRead(() => {
|
|
|
|
|
|
|
|
throw error;
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
return resultBuffer.maybeRead(() => {
|
|
|
|
|
|
|
|
throw error;
|
|
|
|
|
|
|
|
});
|
|
|
|
});
|
|
|
|
}).catch((error) => !isAborted(error), (error) => {
|
|
|
|
}).catch((error) => !isAborted(error), (error) => {
|
|
|
|
return Promise.try(() => {
|
|
|
|
return Promise.try(() => {
|
|
|
|