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 found that on Windows, if a console is generated from stderr, output sent towards the console will go into stdout with extra warning like failed to get console mode for stdout: The handle is invalid.(resovled in 7b7885a).
Verified this with a simple test program in here which simply outputs three messages
// 1. generate console from stderrc, err:=console.ConsoleFromFile(os.Stderr)
iferr!=nil {
fmt.Println("failed to generate console from stderr", err)
os.Exit(1)
}
// 2. output to stderr, stdout and consolefmt.Fprintln(os.Stderr, "via os.Stderr")
fmt.Fprintln(os.Stdout, "via os.Stdout")
fmt.Fprintln(c, "via stderr console")
In Powershell, the output is like:
> $a=.\console.exevia os.Stderr
> $afailed to get console mode for stdout: The handle is invalid.via os.Stdoutvia stderr console
The via stderr console log goes wrongly into the variable $a (which should only contain the command's success output stream and stdout output).
As a comparison, below is the behavior of the test program on Zsh(Ubuntu 20.04)
I found that on Windows, if a console is generated from stderr, output sent towards the console will go into stdout
with extra warning like.failed to get console mode for stdout: The handle is invalid.
(resovled in 7b7885a)Verified this with a simple test program in here which simply outputs three messages
In Powershell, the output is like:
The
via stderr console
log goes wrongly into the variable$a
(which should only contain the command's success output stream and stdout output).As a comparison, below is the behavior of the test program on Zsh(Ubuntu 20.04)
We can see tht the
via stderr console
doesn't goes into the stdout output as expected.The text was updated successfully, but these errors were encountered: