Conversation
There was a problem hiding this comment.
Nice catch! We can't use IsTerminal on a colorable stream; that will always return false even if it would return true for the original stream.
It looks like the release-cmd branch might inadvertently fix this due to the changes to iostreams.System() I've made there: https://github.com/cli/cli/pull/1552/files#diff-9e30abd45545c3e865502cae5bf624d9
There, we first check IsTerminal and only after that we convert the streams to colorable. That approach does not require us to add any build tags. What do you think?
|
I'm totally fine with that solution! I do not like the build tags hack at all. I for a second thought that the isTerminal check wouldn't work on powershell anyway, but I just tested it and that will work fine. However, we wanted to release today, right? It seems unwise to rush releases in today and I'd love to not have things so broken on powershell; can you backport the iostreams changes? |
|
nevermind, I'll backport the fix from 1552 |
closes #1581
Only under Powershell we were failing to accurately tell if a command was running attached to a tty or not due to our use of colorableOut. This PR
tweaks the check to account for thisbackports a change made in #1552 that cached the isTerminal check prior to creating a colorable, avoiding the bug.I had to do a gross hack to fix this and am open to suggestion.colorableonly builds thecolorable.Writertype if built on windows; this made detecting the above scenario very difficult. I had to make a shim type that is conditionally built in order to get this compiling on all of our CI test nodes.