File tree Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Expand file tree Collapse file tree 2 files changed +27
-1
lines changed Original file line number Diff line number Diff line change @@ -733,7 +733,8 @@ function errorBuffer(state) {
733
733
734
734
// If there's something in the buffer waiting, then process it.
735
735
function clearBuffer ( stream , state ) {
736
- if ( ( state [ kState ] & ( kDestroyed | kBufferProcessing | kCorked | kBuffered ) ) !== kBuffered ) {
736
+ if ( ( state [ kState ] & ( kDestroyed | kBufferProcessing | kCorked | kBuffered ) ) !== kBuffered ||
737
+ ( state [ kState ] & ( kDestroyed | kBufferProcessing | kCorked | kConstructed ) ) !== kConstructed ) {
737
738
return ;
738
739
}
739
740
Original file line number Diff line number Diff line change
1
+ 'use strict' ;
2
+
3
+ // Test 'uncork' for WritableStream.
4
+ // Refs: https://github.com/nodejs/node/issues/50979
5
+
6
+ const common = require ( '../common' ) ;
7
+ const fs = require ( 'fs' ) ;
8
+ const assert = require ( 'assert' ) ;
9
+ const tmpdir = require ( '../common/tmpdir' ) ;
10
+
11
+ const filepath = tmpdir . resolve ( 'write_stream.txt' ) ;
12
+ tmpdir . refresh ( ) ;
13
+
14
+ const data = 'data' ;
15
+
16
+ const fileWriteStream = fs . createWriteStream ( filepath ) ;
17
+
18
+ fileWriteStream . on ( 'finish' , ( ) => {
19
+ const writtenData = fs . readFileSync ( filepath , 'utf8' ) ;
20
+ assert . strictEqual ( writtenData , data ) ;
21
+ } ) ;
22
+ fileWriteStream . cork ( ) ;
23
+ fileWriteStream . write ( data , common . mustCall ( ) ) ;
24
+ fileWriteStream . uncork ( ) ;
25
+ fileWriteStream . end ( ) ;
You can’t perform that action at this time.
0 commit comments