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
Some prompts spam terminal when redirecting stdout.
As far as I found out, some prompts include "select", "multiselect", "number", "autosuggest", and "autosuggestMultiselect".
To Reproduce
Create a file and call prompt with { type: "select", stdout: process.stderr }.
Run the script and redirect stdout to something (such as /dev/null).
Type "number" will not output duplicately until some errors occurs.
When removing redirection it runs correctly.
Expected behavior
Should run properly even if stdout is redirected.
System
OS: Ubuntu 20.04 on WSL on Windows 10 2004
Terminal: Windows Terminal (used in the screenshots), VSCode integrated, and WSL console
Node version: both v8.17.0 and v14.11.0
Additional context
This issue seems to be caused by clear function. It uses process.stdout.columns even if it should use process.stderr.columns. When stdout is redirected to something, process.stdout.columns will be undefined, so "clear" clears nothing.
Describe the bug
Some prompts spam terminal when redirecting stdout.
As far as I found out, some prompts include
"select"
,"multiselect"
,"number"
,"autosuggest"
, and"autosuggestMultiselect"
.To Reproduce
prompt
with{ type: "select", stdout: process.stderr }
.Run the script and redirect stdout to something (such as
![image](https://user-images.githubusercontent.com/46275902/95010094-a3861580-0661-11eb-9c9f-f98d434e9342.png)
![image](https://user-images.githubusercontent.com/46275902/95013587-3469ea80-067c-11eb-9dea-fde4e5848f9a.png)
/dev/null
).Type
"number"
will not output duplicately until some errors occurs.When removing redirection it runs correctly.
![image](https://user-images.githubusercontent.com/46275902/95010077-8a7d6480-0661-11eb-9d87-f188104968fa.png)
Expected behavior
Should run properly even if stdout is redirected.
System
v8.17.0
andv14.11.0
Additional context
This issue seems to be caused by
clear
function. It usesprocess.stdout.columns
even if it should useprocess.stderr.columns
. When stdout is redirected to something,process.stdout.columns
will beundefined
, so "clear" clears nothing.similar issues: #89 #153 #175
The text was updated successfully, but these errors were encountered: