Skip to content

Commit e14d7a2

Browse files
committed
fix: suppress xlings subprocess noise on Windows during bootstrap
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.
1 parent 0d13640 commit e14d7a2

1 file changed

Lines changed: 5 additions & 3 deletions

File tree

src/xlings.cppm

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -625,9 +625,10 @@ int install_with_progress(const Env& env, std::string_view target,
625625
auto cmd = [&]() -> std::string {
626626
if constexpr (mcpp::platform::is_windows) {
627627
// Fallback to interface path if direct install fails
628-
return std::format("{} interface install_packages --args {}",
628+
return std::format("{} interface install_packages --args {} {}",
629629
env.binary.string(),
630-
shq(argsJson));
630+
shq(argsJson),
631+
mcpp::platform::null_redirect);
631632
} else {
632633
return std::format(
633634
"cd {} && env -u XLINGS_PROJECT_DIR XLINGS_HOME={} {} interface install_packages --args {} {}",
@@ -744,7 +745,8 @@ void ensure_init(const Env& env, bool quiet) {
744745
if constexpr (mcpp::platform::is_windows) {
745746
mcpp::platform::env::set("XLINGS_HOME", env.home.string());
746747
mcpp::platform::env::set("XLINGS_PROJECT_DIR", "");
747-
cmd = env.binary.string() + " self init";
748+
cmd = env.binary.string() + " self init "
749+
+ std::string(mcpp::platform::shell::silent_redirect);
748750
} else {
749751
cmd = std::format(
750752
"cd {} && env -u XLINGS_PROJECT_DIR XLINGS_HOME={} {} self init {}",

0 commit comments

Comments
 (0)