-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Reduce the amount of startup banner text #16516
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
0cdc4f8
89a8f4b
162ae74
cac7785
b4531ee
76a6520
afe37a9
eb6a9b7
f1e0411
4906c6c
d5eea4f
d6d7172
ed082b8
48f80e5
62abe03
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -833,6 +833,64 @@ namespace StackTest { | |
| $LASTEXITCODE | Should -Be $ExitCodeBadCommandLineParameter | ||
| } | ||
| } | ||
|
|
||
| Context "Startup banner text tests" -Tag Slow { | ||
| BeforeAll { | ||
| $outputPath = "Temp:\StartupBannerTest-Output-${Pid}.txt" | ||
| $inputPath = "Temp:\StartupBannerTest-Input.txt" | ||
| "exit" > $inputPath | ||
|
|
||
| # Not testing update notification banner text here | ||
| $oldPowerShellUpdateCheck = $env:POWERSHELL_UPDATECHECK | ||
| $env:POWERSHELL_UPDATECHECK = "Off" | ||
|
|
||
| # Set TERM to "dumb" to avoid DECCKM codes in the output | ||
| $oldTERM = $env:TERM | ||
| $env:TERM = "dumb" | ||
|
Comment on lines
+847
to
+849
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Should this be done only on non-Windows?
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It probably only needs to be done non-WIndows since the DECCKM failures I saw were on mac/linux. That said, I don't believe it hurts to set TERM="dumb" on Windows. |
||
|
|
||
| $escPwd = [regex]::Escape($pwd) | ||
| $expectedPromptPattern = "^PS ${escPwd}> exit`$" | ||
|
|
||
| $spArgs = @{ | ||
| FilePath = $powershell | ||
| ArgumentList = @("-NoProfile") | ||
| RedirectStandardInput = $inputPath | ||
| RedirectStandardOutput = $outputPath | ||
iSazonov marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| WorkingDirectory = $pwd | ||
| PassThru = $true | ||
| NoNewWindow = $true | ||
| UseNewEnvironment = $false | ||
| } | ||
| } | ||
| AfterAll { | ||
| $env:TERM = $oldTERM | ||
| $env:POWERSHELL_UPDATECHECK = $oldPowerShellUpdateCheck | ||
|
|
||
| Remove-Item $inputPath -Force -ErrorAction Ignore | ||
| Remove-Item $outputPath -Force -ErrorAction Ignore | ||
| } | ||
| BeforeEach { | ||
| Remove-Item $outputPath -Force -ErrorAction Ignore | ||
iSazonov marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| } | ||
| It "Displays expected startup banner text by default" { | ||
| $process = Start-Process @spArgs | ||
| Wait-UntilTrue -sb { $process.HasExited } -TimeoutInMilliseconds 5000 -IntervalInMilliseconds 250 | Should -BeTrue | ||
|
|
||
| $out = @(Get-Content $outputPath) | ||
| $out.Count | Should -Be 2 | ||
| $out[0] | Should -BeExactly "PowerShell $($PSVersionTable.GitCommitId)" | ||
| $out[1] | Should -MatchExactly $expectedPromptPattern | ||
| } | ||
| It "Displays only the prompt with -NoLogo" { | ||
| $spArgs["ArgumentList"] += "-NoLogo" | ||
| $process = Start-Process @spArgs | ||
| Wait-UntilTrue -sb { $process.HasExited } -TimeoutInMilliseconds 5000 -IntervalInMilliseconds 250 | Should -BeTrue | ||
|
|
||
| $out = @(Get-Content $outputPath) | ||
| $out.Count | Should -Be 1 | ||
| $out[0] | Should -MatchExactly $expectedPromptPattern | ||
| } | ||
| } | ||
| } | ||
|
|
||
| Describe "WindowStyle argument" -Tag Feature { | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.