mirror of
https://github.com/ScoopInstaller/Scoop.git
synced 2025-10-30 14:17:54 +00:00
feat(core): Add -Silent switch for Invoke-ExternalCommand (#5346)
This commit is contained in:
@@ -5,6 +5,7 @@
|
||||
- **scoop-update:** Add support for parallel syncing buckets in PowerShell 7 and improve output ([#5122](https://github.com/ScoopInstaller/Scoop/issues/5122))
|
||||
- **config:** Support portable config file ([#5369](https://github.com/ScoopInstaller/Scoop/issues/5369))
|
||||
- **bucket:** Make official buckets higher priority ([#5398](https://github.com/ScoopInstaller/Scoop/issues/5398))
|
||||
- **core:** Add `-Quiet` switch for `Invoke-ExternalCommand` ([#5346](https://github.com/ScoopInstaller/Scoop/issues/5346))
|
||||
|
||||
### Bug Fixes
|
||||
|
||||
|
||||
11
lib/core.ps1
11
lib/core.ps1
@@ -568,6 +568,9 @@ function Invoke-ExternalCommand {
|
||||
[Parameter(ParameterSetName = "UseShellExecute")]
|
||||
[Switch]
|
||||
$RunAs,
|
||||
[Parameter(ParameterSetName = "UseShellExecute")]
|
||||
[Switch]
|
||||
$Quiet,
|
||||
[Alias("Msg")]
|
||||
[String]
|
||||
$Activity,
|
||||
@@ -597,9 +600,12 @@ function Invoke-ExternalCommand {
|
||||
if ($RunAs) {
|
||||
$Process.StartInfo.UseShellExecute = $true
|
||||
$Process.StartInfo.Verb = 'RunAs'
|
||||
} else {
|
||||
$Process.StartInfo.CreateNoWindow = $true
|
||||
}
|
||||
if ($Quiet) {
|
||||
$Process.StartInfo.UseShellExecute = $true
|
||||
$Process.StartInfo.WindowStyle = [System.Diagnostics.ProcessWindowStyle]::Hidden
|
||||
}
|
||||
if ($ArgumentList.Length -gt 0) {
|
||||
if ($FilePath -match '^((cmd|cscript|wscript|msiexec)(\.exe)?|.*\.(bat|cmd|js|vbs|wsf))$') {
|
||||
$Process.StartInfo.Arguments = $ArgumentList -join ' '
|
||||
} elseif ($Process.StartInfo.ArgumentList.Add) {
|
||||
@@ -621,6 +627,7 @@ function Invoke-ExternalCommand {
|
||||
}
|
||||
$Process.StartInfo.Arguments = $escapedArgs -join ' '
|
||||
}
|
||||
}
|
||||
try {
|
||||
[void]$Process.Start()
|
||||
} catch {
|
||||
|
||||
Reference in New Issue
Block a user