Dlaczego Powershell ISE pokazuje błędy, których nie pokazuje konsola PowerShell?
Używam dokładnie tego samego pliku script.ps1 w ISE Powershell (ręczne ładowanie skryptu i naciśnięcie F5) oraz w konsoli Powershell (wykonywanie pliku skryptu).Oboje działają, ale ISE pokazuje błędy, których nie obsługuje konsola. Czemu?
Kod to:
git push origin master
Write-Host "lastExitCode: $lastExitCode Last command was successful: $?"
Ten kod generuje ten błąd w ISE:
git.cmd : Initializing to normal mode
At E:\script.ps1:28 char:4
+ git <<<< push origin master
+ CategoryInfo : NotSpecified: (Initializing to normal mode:String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
Initializing to normal mode
Everything up-to-date
lastExitCode: 0 Last command was successful: False
A to w konsoli:
Everything up-to-date
lastExitCode: 0 Last command was successful: True
Widać, że status sukcesu również nie jest taki sam.