-
Notifications
You must be signed in to change notification settings - Fork 365
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(spin): preserve color output when --show-output
is given
#850
fix(spin): preserve color output when --show-output
is given
#850
Conversation
f7ffddc
to
9eaccca
Compare
7588eef
to
b93a075
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
code lgtm, I was just gonna ask about windows but pinged @andreynering instead
b93a075
to
da77e9a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Few nitpicks, but LGTM otherwise!
if err = stdoutPty.Start(executing); err != nil { | ||
return errorMsg(err) | ||
} | ||
_ = xpty.WaitProcess(context.Background(), executing) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just an FYI, we don't need to use xpty.WaitProcess
here, we can call executing.Wait()
directly. That's what it does under the hood.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aymanbagabas I decided to keep as is so the code is more prepared to work on Windows if we decide to try again in the future. WDYT?
if isTerminal && runtime.GOOS == "windows" { | ||
executing.Stdout = io.MultiWriter(&bothbuf, &outbuf) | ||
executing.Stderr = io.MultiWriter(&bothbuf, &errbuf) | ||
_ = executing.Run() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
After some headache, me and @aymanbagabas decided to keep the old behavior on Windows for now.
(Git Bash was freezing for some reason, although the other terminals worked correctly).
We can reconsider in the future if we find a reliable way to make it work on Windows.
da77e9a
to
f66c0ba
Compare
Fixes #305
Running the command inside a PTY (using this package) to ensure colors and general formatting are preserved.