From 13c474b7686b5e1fd6c5b21b105197a0da6c823d Mon Sep 17 00:00:00 2001 From: "Dax T. Games" Date: Sun, 17 Jul 2016 18:28:38 -0500 Subject: [PATCH] added kill ssh-agent to build.ps1 --- scripts/build.ps1 | 12 ++++++++++++ scripts/utils.ps1 | 1 + 2 files changed, 13 insertions(+) diff --git a/scripts/build.ps1 b/scripts/build.ps1 index 473cfbe..62eb4e5 100644 --- a/scripts/build.ps1 +++ b/scripts/build.ps1 @@ -53,6 +53,10 @@ Param( [switch]$Compile ) +# Get the scripts and cmder root dirs we are building in. +$ScriptRoot = Split-Path -Parent -Path $MyInvocation.MyCommand.Definition +$cmder_root = $ScriptRoot.replace("\scripts","") + # Dot source util functions into this scope . ".\utils.ps1" $ErrorActionPreference = "Stop" @@ -75,6 +79,14 @@ if ($config -ne "") { } else { $ConEmuXml = "" } } else { $ConEmuXml = "" } +# Kill ssh-agent.exe if it is running from the $env:cmder_root we are building +foreach ($ssh_agent in $(get-process ssh-agent -erroraction silentlycontinue)) { + if ([string]$($ssh_agent.path) -match [string]$cmder_root.replace('\','\\')) { + write-verbose $("Stopping " + $ssh_agent.path + "!") + stop-process $ssh_agent.id + } +} + $vend = $pwd foreach ($s in $sources) { Write-Verbose "Getting $($s.name) from URL $($s.url)" diff --git a/scripts/utils.ps1 b/scripts/utils.ps1 index cf7fe7b..b3c1585 100644 --- a/scripts/utils.ps1 +++ b/scripts/utils.ps1 @@ -28,6 +28,7 @@ function Delete-Existing ($path) { } function Extract-Archive ($source, $target) { + Write-Verbose $("Extracting Archive '$cmder_root\vendor\" + $source.replace('/','\') + " to '$cmder_root\vendor\$target'") Invoke-Expression "7z x -y -o`"$($target)`" `"$source`" > `$null" if ($lastexitcode -ne 0) { Write-Error "Extracting of $source failied"