Skip to content

Commit

Permalink
Merge pull request #211 from GrahamTheCoder/master
Browse files Browse the repository at this point in the history
Improve pageant process handling
  • Loading branch information
theaquamarine committed Sep 8, 2015
2 parents ec7ee5d + fe191a2 commit ea6533d
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions GitUtils.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -248,7 +248,7 @@ function Set-TempEnv($key, $value) {
# is a running agent.
function Get-SshAgent() {
if ($env:GIT_SSH -imatch 'plink') {
$pageantPid = Get-Process | Where-Object { $_.Name -eq 'pageant' } | Select -ExpandProperty Id
$pageantPid = Get-Process | Where-Object { $_.Name -eq 'pageant' } | Select -ExpandProperty Id -First 1
if ($null -ne $pageantPid) { return $pageantPid }
} else {
$agentPid = $Env:SSH_AGENT_PID
Expand Down Expand Up @@ -307,7 +307,7 @@ function Start-SshAgent([switch]$Quiet) {
$pageant = Get-Command pageant -TotalCount 1 -Erroraction SilentlyContinue
$pageant = if ($pageant) {$pageant} else {Guess-Pageant}
if (!$pageant) { Write-Warning "Could not find Pageant."; return }
& $pageant
Start-Process -NoNewWindow $pageant
} else {
$sshAgent = Get-Command ssh-agent -TotalCount 1 -ErrorAction SilentlyContinue
$sshAgent = if ($sshAgent) {$sshAgent} else {Guess-Ssh('ssh-agent')}
Expand Down

0 comments on commit ea6533d

Please sign in to comment.