@inthedark/wb 0.0.3 → 0.0.4
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/WorkbenchInstallPrompt.mjs +15 -2
- package/package.json +2 -2
|
@@ -27,11 +27,13 @@ export default class WorkbenchInstallPrompt {
|
|
|
27
27
|
home = os.homedir(),
|
|
28
28
|
schedule = scheduleFrames,
|
|
29
29
|
now = () => performance.now(),
|
|
30
|
+
signals = process,
|
|
30
31
|
} = {}) {
|
|
31
32
|
this.input = input;
|
|
32
33
|
this.output = output;
|
|
33
34
|
this.schedule = schedule;
|
|
34
35
|
this.now = now;
|
|
36
|
+
this.signals = signals;
|
|
35
37
|
this.paths = platform === "win32" ? path.win32 : path.posix;
|
|
36
38
|
this.windows = platform === "win32";
|
|
37
39
|
this.cwd = cwd;
|
|
@@ -202,6 +204,7 @@ export default class WorkbenchInstallPrompt {
|
|
|
202
204
|
this.input.removeListener("keypress", onKey);
|
|
203
205
|
this.input.removeListener("end", onEnd);
|
|
204
206
|
this.input.removeListener("error", onError);
|
|
207
|
+
this.signals.removeListener("SIGINT", onEnd);
|
|
205
208
|
process.removeListener("exit", restoreScreen);
|
|
206
209
|
try {
|
|
207
210
|
this.input.setRawMode(Boolean(wasRaw));
|
|
@@ -229,12 +232,11 @@ export default class WorkbenchInstallPrompt {
|
|
|
229
232
|
finish(error);
|
|
230
233
|
}
|
|
231
234
|
};
|
|
232
|
-
this.input.on("keypress", onKey);
|
|
233
235
|
this.input.once("end", onEnd);
|
|
234
236
|
this.input.once("error", onError);
|
|
237
|
+
this.signals.once("SIGINT", onEnd);
|
|
235
238
|
try {
|
|
236
239
|
this.input.setRawMode(true);
|
|
237
|
-
this.input.resume();
|
|
238
240
|
screenActive = true;
|
|
239
241
|
process.once("exit", restoreScreen);
|
|
240
242
|
const cubeRows = this.cubeRows(label, promptLines);
|
|
@@ -248,6 +250,17 @@ export default class WorkbenchInstallPrompt {
|
|
|
248
250
|
catch (error) { finish(error); }
|
|
249
251
|
});
|
|
250
252
|
}
|
|
253
|
+
let bufferedInterrupt = false;
|
|
254
|
+
for (let chunk = this.input.read(); chunk !== null; chunk = this.input.read()) {
|
|
255
|
+
const text = typeof chunk === "string" ? chunk : Buffer.from(chunk).toString();
|
|
256
|
+
bufferedInterrupt ||= text.includes("\u0003") || text.includes("\u0004");
|
|
257
|
+
}
|
|
258
|
+
if (bufferedInterrupt) {
|
|
259
|
+
onEnd();
|
|
260
|
+
return;
|
|
261
|
+
}
|
|
262
|
+
this.input.on("keypress", onKey);
|
|
263
|
+
this.input.resume();
|
|
251
264
|
} catch (error) {
|
|
252
265
|
finish(error);
|
|
253
266
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inthedark/wb",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.4",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,7 +14,7 @@
|
|
|
14
14
|
"node": ">=22.13.0"
|
|
15
15
|
},
|
|
16
16
|
"bin": {
|
|
17
|
-
"wb": "
|
|
17
|
+
"wb": "wb"
|
|
18
18
|
},
|
|
19
19
|
"exports": {
|
|
20
20
|
".": {
|