File tree Expand file tree Collapse file tree 2 files changed +11
-6
lines changed
src/System.Management.Automation/FormatAndOutput/common
test/powershell/Modules/Microsoft.PowerShell.Utility Expand file tree Collapse file tree 2 files changed +11
-6
lines changed Original file line number Diff line number Diff line change @@ -456,9 +456,16 @@ private void ProcessFormatStart(FormatMessagesContextManager.OutputContext c)
456
456
/// <param name="c">Current context, with Fs in it.</param>
457
457
private void ProcessFormatEnd ( FormatEndData fe , FormatMessagesContextManager . OutputContext c )
458
458
{
459
- // Console.WriteLine("ProcessFormatEnd");
460
- // we just add an empty line to the display
461
- this . LineOutput . WriteLine ( string . Empty ) ;
459
+ if ( c is FormatOutputContext foContext
460
+ && foContext . Data . shapeInfo is ListViewHeaderInfo )
461
+ {
462
+ // Skip writing out a new line for List view, because we already wrote out
463
+ // an extra new line after displaying the last list entry.
464
+ return ;
465
+ }
466
+
467
+ // We just add an empty line to the display.
468
+ LineOutput . WriteLine ( string . Empty ) ;
462
469
}
463
470
464
471
/// <summary>
Original file line number Diff line number Diff line change @@ -37,7 +37,7 @@ Describe "Format-List" -Tags "CI" {
37
37
}
38
38
39
39
It " Should produce the expected output" {
40
- $expected = " ${nl} testName : testValue${nl}${nl}${nl} "
40
+ $expected = " ${nl} testName : testValue${nl}${nl} "
41
41
$in = New-Object PSObject
42
42
Add-Member - InputObject $in - MemberType NoteProperty - Name testName - Value testValue
43
43
@@ -201,7 +201,6 @@ dbda : KM
201
201
消息 : 千
202
202
203
203
204
-
205
204
"@
206
205
$expected = $expected -replace " `r`n " , " `n "
207
206
@@ -224,7 +223,6 @@ float : 9876.543
224
223
decimal : 4567.123456789
225
224
226
225
227
-
228
226
"@
229
227
230
228
$actual = $o | Format-List | Out-String
You can’t perform that action at this time.
0 commit comments