From 55c1b5a411ffddeed3b9dc9513c501ad4ca18fd4 Mon Sep 17 00:00:00 2001 From: sunrisepeak Date: Wed, 20 May 2026 10:23:12 +0800 Subject: [PATCH] fix: suppress xlings subprocess noise on Windows during bootstrap MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Two places in the first-run bootstrap path were missing output redirection on Windows, causing xlings internal messages to leak to the terminal: 1. ensure_init(): `xlings self init` ran without any output redirect on Windows (Linux/macOS already had >/dev/null 2>&1). Now appends platform::shell::silent_redirect (">/dev/null 2>&1" on Windows). 2. install_with_progress() fallback: the NDJSON interface command had no stderr redirect on Windows (Linux/macOS had 2>/dev/null). Now appends platform::null_redirect ("2>nul" on Windows). After this fix, the first-run experience is consistent across all three platforms — only mcpp's own status messages and progress bars are shown; xlings internal output is fully suppressed. --- src/xlings.cppm | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/xlings.cppm b/src/xlings.cppm index 04cc6cc..b7faf06 100644 --- a/src/xlings.cppm +++ b/src/xlings.cppm @@ -625,9 +625,10 @@ int install_with_progress(const Env& env, std::string_view target, auto cmd = [&]() -> std::string { if constexpr (mcpp::platform::is_windows) { // Fallback to interface path if direct install fails - return std::format("{} interface install_packages --args {}", + return std::format("{} interface install_packages --args {} {}", env.binary.string(), - shq(argsJson)); + shq(argsJson), + mcpp::platform::null_redirect); } else { return std::format( "cd {} && env -u XLINGS_PROJECT_DIR XLINGS_HOME={} {} interface install_packages --args {} {}", @@ -744,7 +745,8 @@ void ensure_init(const Env& env, bool quiet) { if constexpr (mcpp::platform::is_windows) { mcpp::platform::env::set("XLINGS_HOME", env.home.string()); mcpp::platform::env::set("XLINGS_PROJECT_DIR", ""); - cmd = env.binary.string() + " self init"; + cmd = env.binary.string() + " self init " + + std::string(mcpp::platform::shell::silent_redirect); } else { cmd = std::format( "cd {} && env -u XLINGS_PROJECT_DIR XLINGS_HOME={} {} self init {}",