You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: lib/utils/display.js
+24-7Lines changed: 24 additions & 7 deletions
Original file line number
Diff line number
Diff line change
@@ -333,20 +333,37 @@ class Display {
333
333
this.#progress.off()
334
334
break
335
335
336
-
caseinput.KEYS.end:
336
+
caseinput.KEYS.end:{
337
337
log.resume()
338
+
// For silent prompts (like password), add newline to preserve output
339
+
if(meta?.silent){
340
+
output.standard('')
341
+
}
338
342
output.flush()
339
343
this.#progress.resume()
340
344
break
345
+
}
341
346
342
347
caseinput.KEYS.read: {
343
-
// The convention when calling input.read is to pass in a single fn that returns the promise to await. resolve and reject are provided by proc-log.
348
+
// The convention when calling input.read is to pass in a single fn that returns the promise to await. Resolve and reject are provided by proc-log.
344
349
const[res,rej,p]=args
345
-
returninput.start(()=>p()
346
-
.then(res)
347
-
.catch(rej)
348
-
// Any call to procLog.input.read will render a prompt to the user, so we always add a single newline of output to stdout to move the cursor to the next line.
349
-
.finally(()=>output.standard('')))
350
+
351
+
// Use sequential input management to avoid race condition which causes issues with spinner and adding newlines.
352
+
input.start()
353
+
354
+
returnp()
355
+
.then((result)=>{
356
+
// If user hits enter, process end event and return input.
357
+
input.end({[META]: true,silent: meta?.silent})
358
+
res(result)
359
+
returnresult
360
+
})
361
+
.catch((error)=>{
362
+
// If user hits ctrl+c, add newline to preserve output.
Copy file name to clipboardExpand all lines: tap-snapshots/test/lib/utils/open-url.js.test.cjs
-1Lines changed: 0 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -25,7 +25,6 @@ https://www.npmjs.com
25
25
exports[`test/lib/utils/open-url.js TAP open url prompt does not error when opener cannot find command > Outputs extra Browser unavailable message and url 1`]=`
26
26
npm home:
27
27
https://www.npmjs.com
28
-
29
28
Browser unavailable. Please open the URL manually:
0 commit comments