File tree 3 files changed +38
-0
lines changed
3 files changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -35,6 +35,12 @@ function ReadStream(fd) {
35
35
if ( ! ( this instanceof ReadStream ) ) return new ReadStream ( fd ) ;
36
36
net . Socket . call ( this , fd ) ;
37
37
38
+ if ( this . _writeWatcher ) {
39
+ this . _writeWatcher . stop ( ) ;
40
+ this . _writeWatcher = null ;
41
+ }
42
+ this . writable = false ;
43
+
38
44
var self = this ,
39
45
keypressListeners = this . listeners ( 'keypress' ) ;
40
46
@@ -285,6 +291,12 @@ ReadStream.prototype._emitKey = function(s) {
285
291
function WriteStream ( fd ) {
286
292
if ( ! ( this instanceof WriteStream ) ) return new WriteStream ( fd ) ;
287
293
net . Socket . call ( this , fd ) ;
294
+
295
+ if ( this . _readWatcher ) {
296
+ this . _readWatcher . stop ( ) ;
297
+ this . _readWatcher = null ;
298
+ }
299
+ this . readable = false ;
288
300
}
289
301
inherits ( WriteStream , net . Socket ) ;
290
302
exports . WriteStream = WriteStream ;
Original file line number Diff line number Diff line change
1
+ // Can't test this when 'make test' doesn't assign a tty to the stdout.
2
+ var common = require ( '../common' ) ;
3
+ var assert = require ( 'assert' ) ;
4
+ var tty = require ( 'tty' ) ;
5
+
6
+ assert . ok ( process . stdin instanceof tty . ReadStream ) ;
7
+ assert . ok ( process . stdin . readable ) ;
8
+ assert . ok ( ! process . stdin . writable ) ;
9
+
10
+ assert . ok ( process . stdout instanceof tty . WriteStream ) ;
11
+ assert . ok ( ! process . stdout . readable ) ;
12
+ assert . ok ( process . stdout . writable ) ;
Original file line number Diff line number Diff line change
1
+ // Can't test this when 'make test' doesn't assign a tty to the stdout.
2
+ var common = require ( '../common' ) ;
3
+ var assert = require ( 'assert' ) ;
4
+ var tty = require ( 'tty' ) ;
5
+
6
+ var closed = false ;
7
+ process . stdout . on ( 'close' , function ( ) {
8
+ closed = true ;
9
+ } ) ;
10
+ process . on ( 'exit' , function ( ) {
11
+ assert . ok ( closed ) ;
12
+ } ) ;
13
+
14
+ process . stdout . end ( ) ;
You can’t perform that action at this time.
0 commit comments