Revert EndProcessing to original code
This appears to have been changed in a bad merge. Now these changes are exactly as in source-depot at [SD:706766].
This commit is contained in:
parent
ef25c4e60d
commit
20f103b0d4
1 changed files with 30 additions and 3 deletions
|
@ -1212,12 +1212,39 @@ namespace Microsoft.PowerShell.Commands
|
||||||
{
|
{
|
||||||
ps.AddScript(commandToInvoke);
|
ps.AddScript(commandToInvoke);
|
||||||
|
|
||||||
ps.AddCommand("out-default");
|
EventHandler<DataAddedEventArgs> debugAdded = delegate(Object sender, DataAddedEventArgs e) { DebugRecord record = (DebugRecord)((PSDataCollection<DebugRecord>)sender)[e.Index]; WriteDebug(record.Message); };
|
||||||
ps.Commands.Commands[0].MergeMyResults(PipelineResultTypes.Error, PipelineResultTypes.Output);
|
EventHandler<DataAddedEventArgs> errorAdded = delegate(Object sender, DataAddedEventArgs e) { ErrorRecord record = (ErrorRecord)((PSDataCollection<ErrorRecord>)sender)[e.Index]; WriteError(record); };
|
||||||
|
EventHandler<DataAddedEventArgs> informationAdded = delegate(Object sender, DataAddedEventArgs e) { InformationRecord record = (InformationRecord)((PSDataCollection<InformationRecord>)sender)[e.Index]; WriteInformation(record); };
|
||||||
|
EventHandler<DataAddedEventArgs> progressAdded = delegate(Object sender, DataAddedEventArgs e) { ProgressRecord record = (ProgressRecord)((PSDataCollection<ProgressRecord>)sender)[e.Index]; WriteProgress(record); };
|
||||||
|
EventHandler<DataAddedEventArgs> verboseAdded = delegate(Object sender, DataAddedEventArgs e) { VerboseRecord record = (VerboseRecord)((PSDataCollection<VerboseRecord>)sender)[e.Index]; WriteVerbose(record.Message); };
|
||||||
|
EventHandler<DataAddedEventArgs> warningAdded = delegate(Object sender, DataAddedEventArgs e) { WarningRecord record = (WarningRecord)((PSDataCollection<WarningRecord>)sender)[e.Index]; WriteWarning(record.Message); };
|
||||||
|
|
||||||
ps.Invoke();
|
ps.Streams.Debug.DataAdded += debugAdded;
|
||||||
|
ps.Streams.Error.DataAdded += errorAdded;
|
||||||
|
ps.Streams.Information.DataAdded += informationAdded;
|
||||||
|
ps.Streams.Progress.DataAdded += progressAdded;
|
||||||
|
ps.Streams.Verbose.DataAdded += verboseAdded;
|
||||||
|
ps.Streams.Warning.DataAdded += warningAdded;
|
||||||
|
|
||||||
|
try
|
||||||
|
{
|
||||||
|
Collection<PSObject> results = ps.Invoke();
|
||||||
|
if (results.Count > 0)
|
||||||
|
{
|
||||||
|
WriteObject(results, true);
|
||||||
|
}
|
||||||
pipeline.RemoveFromInvokeHistoryEntryList(entry);
|
pipeline.RemoveFromInvokeHistoryEntryList(entry);
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
ps.Streams.Debug.DataAdded -= debugAdded;
|
||||||
|
ps.Streams.Error.DataAdded -= errorAdded;
|
||||||
|
ps.Streams.Information.DataAdded -= informationAdded;
|
||||||
|
ps.Streams.Progress.DataAdded -= progressAdded;
|
||||||
|
ps.Streams.Verbose.DataAdded -= verboseAdded;
|
||||||
|
ps.Streams.Warning.DataAdded -= warningAdded;
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|
Loading…
Reference in a new issue