Skip to content

[upstream handoff] fix: fall back to flat output when stderr is not a terminal - #10

Draft
rigelbuild-bot wants to merge 1 commit into
upstream-vcs/upstream-base-v0.5.4from
upstream-vcs/upstream-tty-progress
Draft

rigelbuild-bot wants to merge 1 commit into
upstream-vcs/upstream-base-v0.5.4from
upstream-vcs/upstream-tty-progress

Conversation

@rigelbuild-bot

@rigelbuild-bot rigelbuild-bot commented Sep 11, 2026

Copy link
Copy Markdown

This branch is based on upstream v0.5.4 (0c03418), not on this fork's main. Matt pulls it and pushes it to the upstream Codeberg repo (codeberg.org/abrenneke/jj-vine). The two sections below are the text to open the upstream PR with; they are the deliverable, not this fork PR's own description.

Upstream PR title

fix: fall back to flat output when stderr is not a terminal

Upstream PR description

run_stdout selects the indicatif spinner whenever the command supports it and --verbose is off, without checking whether the spinner will actually draw. indicatif renders nothing when stderr is not a usable terminal, so running with stderr piped or captured (CI, an editor's terminal, 2>file) shows no progress at all and the command looks like it has hung.

This builds an interactive spinner only when the run is eligible for one (--verbose off and the command shows progress), then keeps it only if indicatif will actually draw it, checked through the spinner's own is_hidden(). When indicatif would hide it the output falls back to the flat logger, which writes each step through tracing and stays visible. Asking indicatif directly is stronger than testing stderr().is_terminal() in the caller: indicatif also hides on a terminal it cannot drive, so the gate can never disagree with the renderer about whether the spinner appears.

Adds unit tests over the two conditions the caller controls (verbose, and whether the command shows progress); the terminal check is indicatif's and is exercised through it.

Co-authored-by: Matt Wilkinson matt@rigel.build

… terminal

This branch is based on upstream v0.5.4 (0c03418), not on this fork's main. Matt pulls it and pushes it to the upstream Codeberg repo (codeberg.org/abrenneke/jj-vine). The two sections below are the text to open the upstream PR with; they are the deliverable, not this fork PR's own description.

## Upstream PR title

fix: fall back to flat output when stderr is not a terminal

## Upstream PR description

`run_stdout` selects the `indicatif` spinner whenever the command supports it and `--verbose` is off, without checking whether stderr is a terminal. `indicatif` draws nothing when stderr is not a TTY, so running with stderr piped or captured (CI, an editor's terminal, `2>file`) shows no progress at all and the command looks like it has hung.

This gates the choice on `std::io::stderr().is_terminal()` through a small pure helper. When stderr is not a terminal the output falls back to the flat logger, which writes each step through `tracing` and stays visible. `--verbose` still forces flat output.

Adds unit tests over the verbose / command-supports-interactive / is-a-terminal combinations.

Co-authored-by: Matt Wilkinson <matt@rigel.build>
@rigel-mintaka
rigel-mintaka force-pushed the upstream-vcs/upstream-tty-progress branch from 60227b6 to 63b75ce Compare September 11, 2026 23:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants