【发布时间】:2015-01-08 10:24:13
【问题描述】:
在 PowerShell 中,git checkout 运行时没有任何错误消息。在 ISE 中,虽然git checkout 仍然有效,但 ISE 会给出错误消息。
> git checkout master
Your branch is ahead of 'origin/master' by 3 commits.
(use "git push" to publish your local commits)
git : Switched to branch 'master'
At line:1 char:1
+ git checkout master
+ ~~~~~~~~~~~~~~~~~~~
+ CategoryInfo : NotSpecified: (Switched to branch 'master':String) [], RemoteException
+ FullyQualifiedErrorId : NativeCommandError
这不是大问题,因为git checkout 仍然有效。不过,这很烦人,所以我想知道为什么 ISE 会在标准 PowerShell 不抱怨时抱怨,重要的是,我们如何防止这种烦恼。
我查看了Why is Powershell ISE showing errors that Powershell console does not show?,它解释说 ISE 只是显示正常外壳所经历的情况。该答案并未解释如何平息这种烦人的行为。
【问题讨论】:
-
似乎 ise 确实对 powershell 没有的 stderr 输出做出反应,也许看看这个问题的答案:stackoverflow.com/questions/1394084/… 如果您不希望显示错误,您可以将 stderr 重定向到 $像这样
2> $null -
Should/Could this question be re-written 以表示由于 Git 将错误输出流用于其大部分输出(不仅仅是用于结帐),它在任何主机中看起来都很糟糕(不仅仅是ISE)?
标签: git powershell powershell-3.0 powershell-ise