diff --git a/src/chocolatey.resources/helpers/functions/Install-ChocolateyPackage.ps1 b/src/chocolatey.resources/helpers/functions/Install-ChocolateyPackage.ps1 index 4f10c729dd..b0f659d4e9 100644 --- a/src/chocolatey.resources/helpers/functions/Install-ChocolateyPackage.ps1 +++ b/src/chocolatey.resources/helpers/functions/Install-ChocolateyPackage.ps1 @@ -196,6 +196,13 @@ functionality (see links). .PARAMETER IgnoredArguments Allows splatting with arguments that do not apply. Do not use directly. +.PARAMETER BeforeInstall Script +Specifies the commands to run after download has completed but before install steps have begun. +Available in 0.10.9+. + +Use this for starting an auxilary process such as AutoHotkey, so that any timeouts are not +affected by the time to download. + .EXAMPLE > $packageName= 'bob' @@ -287,6 +294,8 @@ param( [parameter(Mandatory=$false)] [alias("useOnlyPackageSilentArgs")][switch] $useOnlyPackageSilentArguments = $false, [parameter(Mandatory=$false)][switch]$useOriginalLocation, + [parameter(Mandatory=$false)] + [scriptblock] $beforeInstall, [parameter(ValueFromRemainingArguments = $true)][Object[]] $ignoredArguments ) [string]$silentArgs = $silentArgs -join ' ' @@ -333,6 +342,10 @@ param( -GetOriginalFileName } + if ($beforeInstall) { + & $beforeInstall + } + Install-ChocolateyInstallPackage -PackageName $packageName ` -FileType $fileType ` -SilentArgs $silentArgs `