You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I've been hacking together an improvement to rye-up.com/get that would enable Windows users to install rye in the same way Linux and macOS users can (piping curl output to shell), though I've hit a wall - no matter what I do, the executable is unable to produce correct output with stdout redirected.
Steps to Reproduce
git clone -b feat/windows/install --single-branch https://github.com/mataha/rye
cd rye
::: Notice I'm redirecting stdout to `nul` here - this is necessary as `cmd.exe`::: prints every command executed when evaluating piped input, prompts included
curl -fsSL "file:///%CD%/scripts/install.cmd"|cmd /d/x/k >nul
Expected Result
Actual Result
As expected - text is on stdout, which is redirected to nul (though the prompt remains visible):
Redirecting the binary's output to stderr makes the entire text get mangled:
::: This makes invoking the binary roughly equivalent to `rye self install >&2`set"RYE_INSTALL_OPTIONS=>&2"
With the following change all ANSI escape sequences are stripped except those in prompts (last line):
diff --git a/rye/src/cli/rye.rs b/rye/src/cli/rye.rs
index 72d7ca357ff3..733710bad41e 100644
--- a/rye/src/cli/rye.rs+++ b/rye/src/cli/rye.rs@@ -525,6 +525,7 @@ fn perform_install(
},
};
+ let _guard = crate::tui::redirect_to_stderr(true);
echo!("{}", style("Welcome to Rye!").bold());
if matches!(mode, InstallMode::AutoInstall) {
I have no idea what's going on; why is dialoguer able to work correctly in every instance?
Admittedly I don't believe this is a bug in rye itself, but I have to start somewhere.
I've been hacking together an improvement to
rye-up.com/get
that would enable Windows users to installrye
in the same way Linux and macOS users can (pipingcurl
output to shell), though I've hit a wall - no matter what I do, the executable is unable to produce correct output with stdout redirected.Steps to Reproduce
Expected Result
Actual Result
As expected - text is on stdout, which is redirected to
nul
(though the prompt remains visible):Redirecting the binary's output to stderr makes the entire text get mangled:
With the following change all ANSI escape sequences are stripped except those in prompts (last line):
I have no idea what's going on; why is
dialoguer
able to work correctly in every instance?Admittedly I don't believe this is a bug in
rye
itself, but I have to start somewhere.Version Info
The text was updated successfully, but these errors were encountered: