quarto emits ANSI cursor-control sequences when stderr is not a terminal
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 2/5
- Tiempo estimado
- 1-3 horas
- Aptitud para principiantes
- 74/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Tranquilo
- Stack tecnológico
- typescript
- Área
- cli
Línea de trabajo
Comienza en src/core/console.ts, luego lee isInteractiveTerminal() en src/core/platform.ts y el manejo relacionado en src/core/log.ts. Reproduce el problema con quarto check versions 2>\u00261 | cat -v, y limita la salida de control del cursor y de progreso a un terminal stderr interactivo. La tarea estará terminada cuando la salida redirigida o canalizada no contenga secuencias ANSI de control del cursor sin procesar, mientras el comportamiento en el terminal siga siendo interactivo.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
When quarto's stderr is piped, redirected to a file, or consumed by an editor build tool (e.g. Emacs M-x compile, VS Code tasks), progress and spinner helpers still emit ANSI cursor-control sequences. These appear as raw escape bytes in the output buffer:
^[[0G^[[2K^[[J^[[0G^[[2K^[[J^[[0G
Reported in https://github.com/orgs/quarto-dev/discussions/14403
Root cause
src/core/console.ts emits cursor-control bytes without checking whether the output stream is a terminal. Specifically, clearLine() calls ansi.eraseLine.cursorLeft() unconditionally, and spinner() and progressBar() gate their output on runningInCI() but not on whether stderr is actually a TTY. withSpinner()'s cancel path always calls clearLine(), regardless of where output goes.
NO_COLOR does not cover this — it governs colors only. --log-format plain governs the log file format, not console output.
The codebase already has the right helper: isInteractiveTerminal() in src/core/platform.ts, which returns Deno.stderr.isTerminal(). It is already used in command/create/cmd.ts and command/publish/cmd.ts to gate interactive prompts, but not in src/core/console.ts.
src/core/log.ts's LogFileHandler.format() already handles this for file output — messages starting with \r are dropped because they are progress lines. The same "progress is terminal-only" notion is not applied to the stderr console handler or to clearLine().
Reproduction
Any quarto command that uses withSpinner or progressBar shows this when stderr is piped. The cleanest CLI-only form:
quarto check versions 2>&1 | cat -v
quarto install tinytex 2>&1 | cat -v
leading to something like
$ quarto check versions 2>&1 | cat -v
Quarto 1.10.3
^M[>] Checking versions of quarto binary dependencies...
Pandoc version 3.8.3: OK
Dart Sass version 1.87.0: OK
Deno version 2.4.5: OK
Typst version 0.14.2: OK
^M[>] Checking versions of quarto dependencies......OK
Or via Emacs M-x compile running quarto render example.qmd --to html, where the compilation buffer is not a TTY.
Suggested direction
Gate clearLine(), spinner(), and progressBar() on isInteractiveTerminal() (extending the !runningInCI() check that is already there to also require a TTY). This matches the idiom already used for interactive prompts in create/publish, and aligns console behavior with the file-handler behavior in log.ts.
- Lenguaje dominante
- JavaScript
- Estrellas
- 6k
- Forks
- 458
- Merge medio
- 21 h 49 min
- PR fusionados (30 d)
- 53
Preparar el entorno
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de quarto-dev/quarto-cli
-
accessibility bug typst
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
quarto-dev/quarto-cli#14947 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
accessibility documentation
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
quarto-dev/quarto-cli#14944 ·
Los mantenedores suelen responder en 1 día
-
maintenance ojs-engine
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
quarto-dev/quarto-cli#14934 ·
Los mantenedores suelen responder en 1 día
-
accessibility bug html themes
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
quarto-dev/quarto-cli#14932 ·
Los mantenedores suelen responder en 1 día
-
documentation
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
quarto-dev/quarto-cli#14915 ·
Los mantenedores suelen responder en 1 día
Todos los issues de quarto-dev/quarto-cli
Issues similares
-
curriculum documentation quality
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
githubnext/gh-aw-workshop#3897 ·
Los mantenedores suelen responder en 2 días
-
agent/quality hive/hosted-available-lke648397-260827-5n31 quality testing
Dificultad 2/5 1-3 horas Aptitud para principiantes 91/100
Los mantenedores suelen responder en 1 día
-
Add: RSV Honduras FeedAbiertocheck:failed feeds:add
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
iptv-org/database#36179 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
[Bug] : Main navigation "Upcoming Events" link navigates to /events/ without query parameterAbiertobug
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
Los mantenedores suelen responder en 1 día