mirror of
https://github.com/PowerShell/PowerShell
synced 2026-06-08 12:12:50 +00:00
Write out OSC indicator only if the stdout is not redirected (#17419)
This commit is contained in:
@@ -237,6 +237,14 @@ Describe 'Tests for $PSStyle automatic variable' {
|
||||
$PSStyle.Progress.MaxWidth = $maxWidth
|
||||
}
|
||||
}
|
||||
|
||||
It 'Do not use OSC indicator when the stdout is redirected' {
|
||||
$pwsh = Join-Path $PSHOME 'pwsh'
|
||||
|
||||
## In the case that the stdout is redirected, pwsh should not write the OSC indicator Ansi sequence.
|
||||
$result = & $pwsh -noprofile -Command { $PSStyle.Progress.UseOSCIndicator = $true; 'hello'} | Format-List
|
||||
$result | Out-String -Stream | Should -BeExactly 'hello'
|
||||
}
|
||||
}
|
||||
|
||||
Describe 'Handle strings with escape sequences in formatting' {
|
||||
|
||||
Reference in New Issue
Block a user