Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

Resolve -WindowStyle Hidden console flashing#10965

Closed
iSazonov wants to merge 7 commits into
PowerShell:masterPowerShell/PowerShell:masterfrom
iSazonov:noconsole-buildiSazonov/PowerShell:noconsole-buildCopy head branch name to clipboard
Closed

Resolve -WindowStyle Hidden console flashing#10965
iSazonov wants to merge 7 commits into
PowerShell:masterPowerShell/PowerShell:masterfrom
iSazonov:noconsole-buildiSazonov/PowerShell:noconsole-buildCopy head branch name to clipboard

Conversation

@iSazonov

@iSazonov iSazonov commented Nov 1, 2019

Copy link
Copy Markdown
Collaborator

PR Summary

Fix #3028

PR Context

#10962 is direct implementation of pwshw idea. pwshw is only one option from many in the complex topic dicussed in #3028. The PR seems add more flexibility and allow to experiment with console, non-console, pseudo-console and GUI modes, allow to implement pwshw in the same way as we did for preview-pwsh, and also fix -WindowStyle Hidden scenario.

Update: I think follow work should be:

  • create xUnit tests for command line parser
  • refactor command line parser
    • make it static
    • move out execution code from parser (parser should only parse)
    • merge EarlyParser and parser

PR Checklist

@daxian-dbw

Copy link
Copy Markdown
Member

@iSazonov Please add description/context for this PR. Also, #10962 is also for fixing #3028, so what is the difference between your fix and that one?

@iSazonov

iSazonov commented Nov 1, 2019

Copy link
Copy Markdown
Collaborator Author

@daxian-dbw #10962 is direct implementation of pwshw idea. pwshw is only one option from many in the complex topic dicussed in #3028. The PR seems add more flexibility and allow to experiment with console, non-console, pseudo-console and GUI modes, allow to implement pwshw in the same way as we did for preview-pwsh, and also fix -WindowStyle Hidden scenario.

@daxian-dbw

Copy link
Copy Markdown
Member

You'd better add the PR description about what you are doing in this PR, so a reviewer would know.

@iSazonov

iSazonov commented Nov 1, 2019

Copy link
Copy Markdown
Collaborator Author

@daxian-dbw Already done.

Update: I think follow work should be:

  • create xUnit tests for command line parser
  • refactor command line parser
    • make it static
    • move out execution code from parser (parser should only parse)
    • merge EarlyParser and parser

@DHowett-MSFT

Copy link
Copy Markdown

Just so you’re aware, attaching to the parent process’s console as a Windows subsystem application (WinExe) will cause handle fighting where half your input will go to the parent and half to the child, and all output will be intermixed. This is because the parent, usually cmd or another instance of powershell will not wait for a spawned Windows subsystem application to exit.

You’ll probably see this:

C:\> pwsh
PowerShell 7.0.0
C:\> PS C:\>

(One prompt from CMD, one from powershell, both running and reading input simultaneously.)

This is impossible to work around without...

  1. A generic solution in the operating system
  2. A hack where powershell knows that it’s spawning another version of powershell, and waits for it to finish (working around the problem only for the PS->PS case.)

@DHowett-MSFT

Copy link
Copy Markdown

Attaching back to the parent’s console handle can also make the console fail to exit because a Windows subsystem application is still attached to it. This happens when you run code from cmd and then type in exit. CMD exits and the window remains because VSCode reattaches to its parent’s console handle.

@iSazonov

Copy link
Copy Markdown
Collaborator Author

@DHowett-MSFT Thanks! The scenario you describe is "Start-Process -NoNewWindow". We have an issue for it. I agree that we can not resolve it in simple way.
Original issue for the PR asks to address a scenario like scheduled task in user session so that user does not see PowerShell window. In the PR I try to demo how simple we can manually allocate a console to resolve the ask if no user IO is implied.

@ghost ghost added the Review - Needed The PR is being reviewed label May 27, 2020
@ghost

ghost commented May 27, 2020

Copy link
Copy Markdown

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Mainainer, Please provide feedback and/or mark it as Waiting on Author

@SteveL-MSFT SteveL-MSFT added this to the 7.2-Consider milestone Dec 9, 2020
@ghost ghost removed this from the 7.2-Consider milestone Dec 9, 2020
@ghost

ghost commented Dec 9, 2020

Copy link
Copy Markdown

Open PRs should not be assigned to milestone, so they are not assigned to the wrong milestone after they are merged. For backport consideration, use a backport label.

@ghost ghost added the Review - Needed The PR is being reviewed label Sep 23, 2021
@ghost

ghost commented Sep 23, 2021

Copy link
Copy Markdown

This pull request has been automatically marked as Review Needed because it has been there has not been any activity for 7 days.
Maintainer, please provide feedback and/or mark it as Waiting on Author

@iSazonov iSazonov closed this Apr 16, 2022
@iSazonov iSazonov deleted the noconsole-build branch April 16, 2022 19:11
@ghost ghost removed the Review - Needed The PR is being reviewed label Apr 16, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Powershell -WindowStyle Hidden still shows a window briefly

7 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.