Skip to content

Commit c567585

Browse files
committed
fixup
1 parent 92d6aa6 commit c567585

File tree

3 files changed

+16
-3
lines changed

3 files changed

+16
-3
lines changed

doc/api/stream.md

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,18 @@ added: v11.4.0
596596
Is `true` if it is safe to call [`writable.write()`][stream-write], which means
597597
the stream has not been destroyed, errored or ended.
598598

599+
##### `writable.writableAborted`
600+
601+
<!-- YAML
602+
added: REPLACEME
603+
-->
604+
605+
> Stability: 1 - Experimental
606+
607+
* {boolean}
608+
609+
Returns whether the stream was destroyed or errored before emitting `'finish'`.
610+
599611
##### `writable.writableEnded`
600612

601613
<!-- YAML

lib/internal/streams/writable.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -865,7 +865,7 @@ ObjectDefineProperties(Writable.prototype, {
865865
enumerable: false,
866866
get: function() {
867867
return !!(
868-
this._writableState.writable &&
868+
this._writableState.writable !== false &&
869869
(this._writableState.destroyed || this._writableState.errored) &&
870870
!this._writableState.finished
871871
);

test/parallel/test-stream-writable-aborted.js

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
'use strict';
22

3+
require('../common');
34
const assert = require('assert');
45
const { Writable } = require('stream');
56

@@ -14,12 +15,12 @@ const { Writable } = require('stream');
1415
}
1516

1617
{
17-
const writable = new writable({
18+
const writable = new Writable({
1819
read() {
1920
}
2021
});
2122
assert.strictEqual(writable.writableAborted, false);
2223
writable.end();
23-
writable.destroy()
24+
writable.destroy();
2425
assert.strictEqual(writable.writableAborted, true);
2526
}

0 commit comments

Comments
 (0)