Don't apply red color to error stream output

This commit is contained in:
Sergei Vorobev 2016-07-28 20:09:57 -07:00
parent a12eff96c0
commit 161940c9aa
2 changed files with 5 additions and 3 deletions

View file

@ -2841,7 +2841,7 @@ namespace System.Management.Automation
/// but the command failure will ultimately be
/// <see cref="System.Management.Automation.ActionPreferenceStopException"/>,
/// </remarks>
internal void _WriteErrorSkipAllowCheck(ErrorRecord errorRecord, ActionPreference? actionPreference = null)
internal void _WriteErrorSkipAllowCheck(ErrorRecord errorRecord, ActionPreference? actionPreference = null, bool isNativeError = false)
{
ThrowIfStopping();
@ -2923,7 +2923,9 @@ namespace System.Management.Automation
PSObject errorWrap = PSObject.AsPSObject(errorRecord);
// It's possible we've already added the member (this method is recursive sometimes
// when tracing), so don't add the member again.
if (errorWrap.Members["writeErrorStream"] == null)
// We don't add a note property on messages that comes from stderr stream.
if (!isNativeError && errorWrap.Members["writeErrorStream"] == null)
{
PSNoteProperty note = new PSNoteProperty("writeErrorStream", true);
errorWrap.Properties.Add(note);

View file

@ -947,7 +947,7 @@ namespace System.Management.Automation
ErrorRecord record = outputValue.Data as ErrorRecord;
Dbg.Assert(record != null, "ProcessReader should ensure that data is ErrorRecord");
record.SetInvocationInfo(this.Command.MyInvocation);
this.commandRuntime._WriteErrorSkipAllowCheck(record);
this.commandRuntime._WriteErrorSkipAllowCheck(record, isNativeError: true);
}
else if (outputValue.Stream == MinishellStream.Output)
{