File tree Expand file tree Collapse file tree 1 file changed +8
-4
lines changed
src/PowerShellEditorServices/Services/PowerShell/Utility Expand file tree Collapse file tree 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -21,22 +21,26 @@ public static PSCommand AddDebugOutputCommand(this PSCommand psCommand)
21
21
22
22
public static PSCommand MergePipelineResults ( this PSCommand psCommand )
23
23
{
24
+ // We need to do merge errors and output before rendering with an Out- cmdlet
24
25
Command lastCommand = psCommand . Commands [ psCommand . Commands . Count - 1 ] ;
25
26
lastCommand . MergeMyResults ( PipelineResultTypes . Error , PipelineResultTypes . Output ) ;
26
27
lastCommand . MergeMyResults ( PipelineResultTypes . Information , PipelineResultTypes . Output ) ;
27
28
return psCommand ;
28
29
}
29
30
31
+ /// <summary>
32
+ /// Get a representation of the PSCommand, for logging purposes.
33
+ /// </summary>
30
34
public static string GetInvocationText ( this PSCommand command )
31
35
{
32
- Command lastCommand = command . Commands [ 0 ] ;
36
+ Command currentCommand = command . Commands [ 0 ] ;
33
37
var sb = new StringBuilder ( ) . AddCommandText ( command . Commands [ 0 ] ) ;
34
38
35
39
for ( int i = 1 ; i < command . Commands . Count ; i ++ )
36
40
{
37
- sb . Append ( lastCommand . IsEndOfStatement ? "; " : " | " ) ;
38
- lastCommand = command . Commands [ i ] ;
39
- sb . AddCommandText ( lastCommand ) ;
41
+ sb . Append ( currentCommand . IsEndOfStatement ? "; " : " | " ) ;
42
+ currentCommand = command . Commands [ i ] ;
43
+ sb . AddCommandText ( currentCommand ) ;
40
44
}
41
45
42
46
return sb . ToString ( ) ;
You can’t perform that action at this time.
0 commit comments