Skip to content
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

feat(core): Create no window by default in Invoke-ExternalCommand #5066

Merged
merged 1 commit into from
Jul 25, 2022

Conversation

lewis-yeung
Copy link
Contributor

@lewis-yeung lewis-yeung commented Jul 25, 2022

Description

Support a new -NoWindow switch which indicates the process should be started without creating a new window to contain it. This switch cannot go with -RunAs.

EDITED: So stupid that I missed the switch in this PR even though I wrote the description above. 😭

Checklist:

  • I have read the Contributing Guide.
  • I have ensured that I am targeting the develop branch.
  • I have updated the documentation accordingly.
  • I have updated the tests accordingly.
  • I have added an entry in the CHANGELOG.

lib/core.ps1 Outdated Show resolved Hide resolved
@lewis-yeung lewis-yeung changed the title feat(core): Support -NoWindow for Invoke-ExternalCommand feat(core): Create no window by default in Invoke-ExternalCommand Jul 25, 2022
@chawyehsu
Copy link
Member

This breaks my install/uninstall scripts for my dorado/msys2-cn. With this forced CreateNoWindow I keep getting error code 3840 while triggering msys2-cn installation. 2 hours were wasted for me finding out this cause. Can we have a switch to stop the forced NoWindow or how could I fix this on my side?

@niheaven
Copy link
Member

niheaven commented Jan 6, 2023

I'm planning to merge #5124 which refactor Invoke-ExternalCommand(), and will add a switch to disable (or make it disabled by default) -CreateNoWindow.

The default behavior of Invoke-ExternalCommand() stops redirecting default output to a variable which could be used later.

@lewis-yeung
Copy link
Contributor Author

lewis-yeung commented Jan 17, 2023

@chawyehsu So sorry that I made a stupid mistake in this PR... 🤦🏻

$Process.StartInfo.CreateNoWindow = $true

A -NoWindow switch should have been added for Invoke-ExternalCommand. I don't know why I didn't add it even though I did write the relevant description at that time:

Support a new -NoWindow switch which indicates the process should be started without creating a new window to contain it.

@niheaven You're right, CreateNoWindow should not be $true by default, though I found that CreateNoWindow never affects GUI apps.

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.

3 participants