See this question for the full context of the behavior I'm trying to understand.
My understanding of Start-Transcript
is that all output streams are logged to the Powershell transcript once it is started. I can write to streams 1-6 and still expect to see the output in my transcript log. However, in the question I linked to above, I'm seeing some strangeness surrounding this I can't explain and would like to understand why the output is swallowed in this case, and in that OP's case, we were each seeing different behavior.
Basically, OP was trying to log git clone | Out-Default
to their transcript log, and was getting nothing logged out to the transcript. The solution that worked for them was to set an environment variable to have git
write to stdout
instead of stderr
. OP later stated that they had tried piping the git
command to Out-Default
to see if it made a difference, which it did not, so they're solution seems to be that "git
outputs to stderr and does not get captured by Start-Transcript
.
My experience differed, however. I do not have git
configured to redirect stderr
to stdout
, and can confirm this by attempting to assign the output of a git command to a variable (which doesn't work, as I expected). Yet I can simply call Start-Transcript
, then call git status
, and see that it logs to the transcript. However, when I run git status | Out-Default
, I get the output to the console, but not logged to the transcript. Removing Out-Default
seemed to be the solution for me, but not for OP.
I'm at a loss as to what is going on here. On my system it seems that piping git
commands, and only git
commands, to Out-Default
does not allow the output to be logged to a transcript. I've tested other external programs with their stderr
output and piping the output to Out-Default
still allows the output to be transcribed. But not git blah | Out-Default
. And I still don't understand why the other question's OP needed to redirect stderr
to stdout
, but I don't.