From c3a1530c18ca74499206107382cd0b99429044d1 Mon Sep 17 00:00:00 2001 From: "L. Yeung" Date: Tue, 26 Jul 2022 00:34:27 +0800 Subject: [PATCH] feat(core): Create no window by default in `Invoke-ExternalCommand` --- CHANGELOG.md | 1 + lib/core.ps1 | 2 ++ 2 files changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index cb1c2e932a..934f15f2c4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,7 @@ ### Features +- **core:** Create no window by default in `Invoke-ExternalCommand` ([#5066](https://github.com/ScoopInstaller/Scoop/issues/5066)) - **core:** Improve argument concatenation in `Invoke-ExternalCommand` ([#5065](https://github.com/ScoopInstaller/Scoop/issues/5065)) ### Bug Fixes diff --git a/lib/core.ps1 b/lib/core.ps1 index 0a03ad22b3..08c3f3a5ac 100644 --- a/lib/core.ps1 +++ b/lib/core.ps1 @@ -520,6 +520,8 @@ function Invoke-ExternalCommand { if ($RunAs) { $Process.StartInfo.UseShellExecute = $true $Process.StartInfo.Verb = 'RunAs' + } else { + $Process.StartInfo.CreateNoWindow = $true } if ($FilePath -match '^((cmd|cscript|wscript|msiexec)(\.exe)?|.*\.(bat|cmd|js|vbs|wsf))$') { $Process.StartInfo.Arguments = $ArgumentList -join ' '