Why is Powershell ISE showing errors that Powershell console does not show? Why is Powershell ISE showing errors that Powershell console does not show? powershell powershell

Why is Powershell ISE showing errors that Powershell console does not show?


I don't know why they output differently, but the message that we see from git push is coming over stderr. This means that they are both showing errors, although the ISE is making them much louder, and converting it into error objects.

Consider this output from the PowerShell prompt:

PS> git pushEverything up-to-datePS> git push 2> $null    # Redirect stderr to $nullPS> $LastExitCode1PS>

and compare it to the ISE:

PS> git pushgit : Everything up-to-dateAt line:1 char:1+ git push+ ~~~~~~~~    + CategoryInfo          : NotSpecified: (Everything up-to-date:String) [], RemoteException    + FullyQualifiedErrorId : NativeCommandErrorPS> git push 2> $nullPS> $LastExitCode1PS>

Except for the extra output from the error object being displayed, the output is the same. The ISE has converted the stderr string to a NativeCommandError object, and it does even display the error message if you look past the red.


as shown in this Stackoverflow answer to prevent git push to print to STDERR the solution is to call the command witn --porcelain option.

then, calling

git push origin master --porcelain

output goes all to STDOUT


So, the example below case have any error , this command -q 2>&1 | %{ "$_" }` will nullifying the result of errors.

A solution and use: git push -q 2>&1 | %{ "$_" }