-
Notifications
You must be signed in to change notification settings - Fork 8.1k
Ignore failure attempting to set console window title #16948
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
Conversation
src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleControl.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleControl.cs
Outdated
Show resolved
Hide resolved
src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleControl.cs
Outdated
Show resolved
Hide resolved
krishnayalavarthi
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good to me
src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleControl.cs
Outdated
Show resolved
Hide resolved
5fce629 to
dc03d45
Compare
This comment was marked as outdated.
This comment was marked as outdated.
dc03d45 to
dfc5c76
Compare
PaulHigin
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Minor comment only.
src/Microsoft.PowerShell.ConsoleHost/host/msh/ConsoleControl.cs
Outdated
Show resolved
Hide resolved
iSazonov
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM with one style comment.
| return consoleTitle.ToString(); | ||
| } | ||
|
|
||
| private static bool dontSetConsoleWindowTitle; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Our style:
| private static bool dontSetConsoleWindowTitle; | |
| private static bool s_dontSetConsoleWindowTitle; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like the convention in the codebase is not an s_, but pascal casing instead of camel
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
codefactor wants to start with lowercase, so changing back to lowercase but not updating rest of codebase.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@SteveL-MSFT Please look our guidelines we follow for years https://github.com/PowerShell/PowerShell/blob/master/docs/dev-process/coding-guidelines.md#naming-conventions
Use camelCase to name internal and private fields and use readonly where possible. Prefix instance fields with , static fields with s and thread static fields with t. When used on static fields, readonly should come after static (i.e. static readonly not readonly static).
This says us to use s_dontSetConsoleWindowTitle
|
This PR has Quantification details
Why proper sizing of changes matters
Optimal pull request sizes drive a better predictable PR flow as they strike a
What can I do to optimize my changes
How to interpret the change counts in git diff output
Was this comment helpful? 👍 :ok_hand: :thumbsdown: (Email) |
|
This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days. |
|
🎉 Handy links: |
PR Summary
Reported by a partner that they are using PowerShell console host in automation where there is no terminal window and SetConsoleWindowTitle call fails and the console host exits. Since this is a useful, but decorative feature, we should handle this gracefully by ignoring the Win32 API error and not attempt to set the window title subsequent times.
PR Checklist
.h,.cpp,.cs,.ps1and.psm1files have the correct copyright headerWIP:or[ WIP ]to the beginning of the title (theWIPbot will keep its status check atPendingwhile the prefix is present) and remove the prefix when the PR is ready.(which runs in a different PS Host).