fix(deps): respect -q flag for provider command stream#9457
Conversation
Follow-up to jdx#8792. After `mise prepare` was renamed to `mise deps`, the summary path stayed quiet via info!/error! but the provider command stream went back to ignoring -q because the on_stdout/on_stderr callbacks in DepsEngine::execute_command write captured lines through prefix_println! and prefix_eprintln!, which expand to calm_io::stdoutln!/stderrln! and never consult Settings::quiet. The `mise install -q` path does not have this problem because it routes output through with_pr(...), and MultiProgressReport::add returns a QuietReport when quiet is set. The deps engine sets explicit on_stdout/ on_stderr callbacks instead, which take precedence over the pr fallback in CmdLineRunner — so the QuietReport never sees the streamed lines. Read Settings::get().quiet once before the closures and short-circuit the prefix prints when set. progress.set_message is left untouched: it is a no-op for QuietReport and still drives the spinner under ProgressReport.
Greptile SummaryThis PR fixes a quiet-flag regression in Confidence Score: 5/5Safe to merge — minimal, targeted fix with no logic regressions and a clean regression test. The change is small, well-scoped, and consistent with how the rest of the codebase handles quiet mode. The No files require special attention. Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[execute_command] --> B{prefixes set AND not raw?}
B -- No --> Z[runner.execute]
B -- Yes --> C[read quiet from Settings]
C --> D[register with_on_stdout closure]
C --> E[register with_on_stderr closure]
D --> F[on_stdout fired]
F --> G[progress.set_message always runs]
G --> H{quiet?}
H -- Yes --> I[return - suppress output]
H -- No --> J[prefix_println to stdout]
E --> K[on_stderr fired]
K --> L{quiet?}
L -- Yes --> M[return - suppress output]
L -- No --> N[prefix_eprintln to stderr]
J --> Z
N --> Z
Reviews (1): Last reviewed commit: "fix(deps): respect -q flag for provider ..." | Re-trigger Greptile |
There was a problem hiding this comment.
Code Review
This pull request implements the -q/--quiet flag for the mise deps command to suppress provider stream output, matching the behavior of mise install. The dependency engine was updated to skip printing to stdout and stderr when the quiet setting is enabled, and new E2E tests were added to verify this functionality. A review comment suggests an optimization to move the quiet check to the top of the stdout closure to prevent unnecessary string cloning and progress message updates.
| if let Some(progress) = progress { | ||
| progress.set_message(line.clone()); | ||
| } | ||
| if quiet { | ||
| return; | ||
| } |
There was a problem hiding this comment.
Moving the quiet check to the top of the closure avoids an unnecessary line.clone() and a dynamic dispatch call to progress.set_message when quiet mode is enabled. Since QuietReport::set_message is a no-op, skipping it entirely is more efficient and consistent with the on_stderr implementation below.
| if let Some(progress) = progress { | |
| progress.set_message(line.clone()); | |
| } | |
| if quiet { | |
| return; | |
| } | |
| if quiet { | |
| return; | |
| } | |
| if let Some(progress) = progress { | |
| progress.set_message(line.clone()); | |
| } |
### 🚀 Features - **(deps)** add aube provider by @jdx in [#9452](#9452) - **(ls-remote)** add strict metadata mode by @jdx in [#9448](#9448) ### 🐛 Bug Fixes - **(env)** parse concatenated short form `-Eval` correctly by @bts in [#9456](#9456) - **(http)** improve HTML detection by using Content-Type header by @phateffect in [#9407](#9407) - **(task)** install monorepo subdir tools before running deps by @jdx in [#9454](#9454) ### 📦️ Dependency Updates - update astral-tokio-tar advisory by @jdx in [#9449](#9449) - respect -q flag for provider command stream by @JamBalaya56562 in [#9457](#9457) ### New Contributors - @JamBalaya56562 made their first contribution in [#9457](#9457) - @bts made their first contribution in [#9456](#9456) - @phateffect made their first contribution in [#9407](#9407) --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com>
Summary
Follow-up to #8792. After
mise preparewas renamed tomise deps,-qstarted leaking provider command output again — runningmise deps install -qagainst e.g. abundlerprovider still streamsbundle install's stdout/stderr through the prefix-tagged tee in the deps engine.#8792 fixed the summary path (
Prepared:/Failed:/All dependencies are up to date) by routing it through the logger viainfo!/error!, and that change carried over tosrc/cli/deps/install.rsafter the rename. But the provider command stream is a separate path that bypasses the logger entirely, so-qnever had any effect on it.Root cause
In
src/deps/engine.rs::execute_command, thewith_on_stdout/with_on_stderrcallbacks unconditionally write captured lines viaprefix_println!/prefix_eprintln!. Both macros expand tocalm_io::stdoutln!/calm_io::stderrln!and never consultSettings::quiet, so the quiet flag passes straight through.mise install -qdoes not have this issue because the install path useswith_pr(...)and routes output throughMultiProgressReport::add, which returns aQuietReport(no-opprintln/set_message) whenSettings::quietis set. The deps engine instead sets expliciton_stdout/on_stderrcallbacks that take precedence over theprfallback inCmdLineRunner— so theQuietReportnever sees the streamed lines.Fix
Read
Settings::get().quietonce before the closures and skip theprefix_println!/prefix_eprintln!calls when set. Theprogress.set_messagecall is left in place: it is a no-op forQuietReportand still drives the spinner underProgressReportin normal mode.This matches
mise install -qbehavior — the provider command stream is suppressed, while logger-routed status (Installed:,Failed:) continues to follow the normal quiet level (errors only).Test plan
e2e/cli/test_deps: with the existingcodegenprovider,mise deps --force --only codegen -qmust contain neither the prefix-tagged stream output ([deps.codegen]) nor the info-level summary (Installed:). The assertion immediately above the new lines proves the same command without-qdoes emit[deps.codegen] codegen, so the pair anchors both directions.mise run test:e2e cli/test_deps cli/test_deps_depends cli/test_deps_tool_install— could not run on this Windows machine (no MSVClink.exe, so evencargo checkfails to link build scripts). Relying on CI for full verification.🤖 Generated with Claude Code