bare-tty 2.1.1 → 2.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (2) hide show
  1. package/index.js +14 -0
  2. package/package.json +1 -1
package/index.js CHANGED
@@ -45,7 +45,14 @@ exports.ReadStream = class TTYReadStream extends Readable {
45
45
  cb(null)
46
46
  }
47
47
 
48
+ _predestroy () {
49
+ if (this._handle === null) return
50
+ binding.close(this._handle)
51
+ TTYReadStream._streams.delete(this)
52
+ }
53
+
48
54
  _destroy (cb) {
55
+ if (this._handle === null) return cb(null)
49
56
  this._pendingDestroy = cb
50
57
  binding.close(this._handle)
51
58
  TTYReadStream._streams.delete(this)
@@ -123,7 +130,14 @@ exports.WriteStream = class TTYWriteStream extends Writable {
123
130
  binding.end(this._handle)
124
131
  }
125
132
 
133
+ _predestroy () {
134
+ if (this._handle === null) return
135
+ binding.close(this._handle)
136
+ TTYWriteStream._streams.delete(this)
137
+ }
138
+
126
139
  _destroy (cb) {
140
+ if (this._handle === null) return cb(null)
127
141
  this._pendingDestroy = cb
128
142
  binding.close(this._handle)
129
143
  TTYWriteStream._streams.delete(this)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-tty",
3
- "version": "2.1.1",
3
+ "version": "2.1.3",
4
4
  "description": "Native TTY streams for JavaScript",
5
5
  "main": "index.js",
6
6
  "files": [