noninteractive 0.3.19 → 0.3.20
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/bin/noninteractive.js +25 -8
- package/package.json +1 -1
package/bin/noninteractive.js
CHANGED
|
@@ -168,13 +168,22 @@ function runDaemon(sessionName, executable, args) {
|
|
|
168
168
|
const detectedUrls = new Set;
|
|
169
169
|
const reportedUrls = new Set;
|
|
170
170
|
const waiters = [];
|
|
171
|
+
let notifyDebounce = null;
|
|
172
|
+
const NOTIFY_SETTLE_MS = 50;
|
|
171
173
|
function notifyWaiters() {
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
174
|
+
if (waiters.length === 0)
|
|
175
|
+
return;
|
|
176
|
+
if (notifyDebounce)
|
|
177
|
+
clearTimeout(notifyDebounce);
|
|
178
|
+
notifyDebounce = setTimeout(() => {
|
|
179
|
+
notifyDebounce = null;
|
|
180
|
+
let w = waiters.shift();
|
|
181
|
+
while (w) {
|
|
182
|
+
clearTimeout(w.timer);
|
|
183
|
+
w.resolve(outputBuffer);
|
|
184
|
+
w = waiters.shift();
|
|
185
|
+
}
|
|
186
|
+
}, NOTIFY_SETTLE_MS);
|
|
178
187
|
}
|
|
179
188
|
const binDir = sessionBinDir2(sessionName);
|
|
180
189
|
const ptyBridge = getPtyBridge();
|
|
@@ -227,7 +236,15 @@ function runDaemon(sessionName, executable, args) {
|
|
|
227
236
|
exitCode = code;
|
|
228
237
|
outputBuffer += `
|
|
229
238
|
[exited ${code}]`;
|
|
230
|
-
|
|
239
|
+
if (notifyDebounce)
|
|
240
|
+
clearTimeout(notifyDebounce);
|
|
241
|
+
notifyDebounce = null;
|
|
242
|
+
let w = waiters.shift();
|
|
243
|
+
while (w) {
|
|
244
|
+
clearTimeout(w.timer);
|
|
245
|
+
w.resolve(outputBuffer);
|
|
246
|
+
w = waiters.shift();
|
|
247
|
+
}
|
|
231
248
|
setTimeout(() => {
|
|
232
249
|
server.close();
|
|
233
250
|
try {
|
|
@@ -347,7 +364,7 @@ var init_daemon = __esm(() => {
|
|
|
347
364
|
var require_package = __commonJS((exports, module) => {
|
|
348
365
|
module.exports = {
|
|
349
366
|
name: "noninteractive",
|
|
350
|
-
version: "0.3.
|
|
367
|
+
version: "0.3.20",
|
|
351
368
|
type: "module",
|
|
352
369
|
bin: {
|
|
353
370
|
noninteractive: "./bin/noninteractive.js"
|