Hacktoberfest 2026: die Issues, die Maintainer für den Oktober markiert haben – offen und einsteigerfreundlich. Hacktoberfest-Issues durchsuchen

quarto emits ANSI cursor-control sequences when stderr is not a terminal

Offen Anfängerfreundlich
#14,419 1 Kommentar 1 Reaktion 0 zugewiesene Personen Auf GitHub ansehen

Maintainer antworten meist innerhalb von 1 Tag

Dieses Issue hat noch niemand übernommen.

Bewertung

Schwierigkeit
2/5
Geschätzter Aufwand
1-3 Stunden
Anfängerfreundlichkeit
74/100
Issue-Typ
Bug
Klarheit
Klar beschrieben
Aktivitätsstatus
Ruhig
Tech-Stack
typescript
Bereich
cli

Rechercherichtung

Beginne in src/core/console.ts, lies dann isInteractiveTerminal() in src/core/platform.ts und die zugehörige Verarbeitung in src/core/log.ts. Reproduziere das Problem mit quarto check versions 2>\u00261 | cat -v, und beschränke die Ausgabe von Cursor-Steuerung und Fortschritt auf ein interaktives stderr-Terminal. Erledigt ist die Aufgabe, wenn umgeleitete oder per Pipe weitergeleitete Ausgabe keine rohen ANSI-Cursor-Steuersequenzen enthält, während sich das Terminal weiterhin interaktiv verhält.

Vom Indexierungsmodell aus dem Issue-Text verfasst.

Beschreibung

bug

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.

https://github.com/quarto-dev/quarto-cli/blob/d5c1f1d51a9628b065da0c1a9f45009bcc8fd00e/src/core/console.ts#L180-L182

https://github.com/quarto-dev/quarto-cli/blob/d5c1f1d51a9628b065da0c1a9f45009bcc8fd00e/src/core/console.ts#L110-L124

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.

https://github.com/quarto-dev/quarto-cli/blob/d5c1f1d51a9628b065da0c1a9f45009bcc8fd00e/src/core/platform.ts#L97-L99

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().

https://github.com/quarto-dev/quarto-cli/blob/d5c1f1d51a9628b065da0c1a9f45009bcc8fd00e/src/core/log.ts#L232-L237

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.

Vorherrschende Sprache
JavaScript
Sterne
6k
Forks
458
Ø Merge
21 Std. 49 Min.
Gemergte PRs (30 T.)
53

Entwicklungsumgebung

Erste Schritte

  1. Lesen Sie das ganze Issue und danach den Beitragsleitfaden des Projekts.
  2. Schreiben Sie ins Issue, dass Sie es übernehmen — das erspart doppelte Arbeit.
  3. Forken Sie das Repository und arbeiten Sie in einem Branch.
  4. Öffnen Sie einen Pull Request, der die Issue-Nummer nennt.

Mehr aus quarto-dev/quarto-cli

Alle Issues in quarto-dev/quarto-cli

Ähnliche Issues

Weitere Issues zu JavaScript

Neue Issues direkt in Ihr Postfach

Eine kurze Übersicht über anfängerfreundliche GitHub-Issues.