diff --git a/src/chocolatey.resources/helpers/functions/Install-ChocolateyPackage.ps1 b/src/chocolatey.resources/helpers/functions/Install-ChocolateyPackage.ps1 index 9131d0f2b3..030c198de1 100644 --- a/src/chocolatey.resources/helpers/functions/Install-ChocolateyPackage.ps1 +++ b/src/chocolatey.resources/helpers/functions/Install-ChocolateyPackage.ps1 @@ -220,6 +220,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.16+. + +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' @@ -359,6 +366,7 @@ 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 ' ' @@ -405,6 +413,10 @@ param( -GetOriginalFileName } + if ($beforeInstall) { + & $beforeInstall + } + Install-ChocolateyInstallPackage -PackageName $packageName ` -FileType $fileType ` -SilentArgs $silentArgs `