bare-tty 5.1.0 → 5.1.2

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.
package/index.js CHANGED
@@ -108,6 +108,7 @@ exports.WriteStream = class TTYWriteStream extends Writable {
108
108
  this._size = null
109
109
 
110
110
  this._pendingWrite = null
111
+ this._pendingWriteBatch = null
111
112
  this._pendingDestroy = null
112
113
 
113
114
  this._handle = binding.init(fd, empty, this, this._onwrite, noop, this._onclose)
@@ -140,12 +141,17 @@ exports.WriteStream = class TTYWriteStream extends Writable {
140
141
  }
141
142
 
142
143
  _writev(batch, cb) {
143
- this._pendingWrite = [cb, batch]
144
-
145
- binding.writev(
146
- this._handle,
147
- batch.map(({ chunk }) => chunk)
148
- )
144
+ this._pendingWrite = cb
145
+ this._pendingWriteBatch = batch
146
+
147
+ try {
148
+ binding.writev(
149
+ this._handle,
150
+ batch.map(({ chunk }) => chunk)
151
+ )
152
+ } catch (err) {
153
+ this._continueWrite(err)
154
+ }
149
155
  }
150
156
 
151
157
  _predestroy() {
@@ -174,8 +180,9 @@ exports.WriteStream = class TTYWriteStream extends Writable {
174
180
 
175
181
  _continueWrite(err) {
176
182
  if (this._pendingWrite === null) return
177
- const cb = this._pendingWrite[0]
183
+ const cb = this._pendingWrite
178
184
  this._pendingWrite = null
185
+ this._pendingWriteBatch = null
179
186
  cb(err)
180
187
  }
181
188
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "bare-tty",
3
- "version": "5.1.0",
3
+ "version": "5.1.2",
4
4
  "description": "Native TTY streams for JavaScript",
5
5
  "exports": {
6
6
  ".": {
@@ -21,7 +21,9 @@
21
21
  ],
22
22
  "addon": true,
23
23
  "scripts": {
24
- "test": "prettier . --check && bare test.js"
24
+ "format": "prettier --write . && lunte --fix",
25
+ "lint": "prettier --check . && lunte",
26
+ "test": "brittle-bare --coverage test.js"
25
27
  },
26
28
  "repository": {
27
29
  "type": "git",
@@ -38,12 +40,13 @@
38
40
  },
39
41
  "dependencies": {
40
42
  "bare-events": "^2.2.0",
41
- "bare-signals": "^4.0.0",
43
+ "bare-signals": "^5.0.0",
42
44
  "bare-stream": "^2.0.0"
43
45
  },
44
46
  "devDependencies": {
45
47
  "brittle": "^3.2.1",
46
48
  "cmake-bare": "^1.1.6",
49
+ "lunte": "^1.8.0",
47
50
  "prettier": "^3.4.1",
48
51
  "prettier-config-holepunch": "^2.0.0"
49
52
  }
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file
Binary file