Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow overriding environment variable scope #15

Merged
merged 8 commits into from
Jul 13, 2018
Merged
Prev Previous commit
Next Next commit
Make sure Stop-SshAgent works with win32 ssh
  • Loading branch information
JeremySkinner committed Jul 11, 2018
commit 5ba06ede78e9f3582486450e93481cd566678cef
5 changes: 5 additions & 0 deletions src/Agent.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,11 @@ function Start-SshAgent {

# Stop a running SSH agent
function Stop-SshAgent() {
if ($nativeAgent = Get-NativeSshAgent) {
Stop-Service $nativeAgent.Name
return
}

[int]$agentPid = Get-SshAgent
if ($agentPid -gt 0) {
# Stop agent process
Expand Down
6 changes: 6 additions & 0 deletions test/Ssh.Tests.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,12 @@ Describe 'SSH Function Tests' {
"$args" -eq 'config --global core.sshCommand "C:/Windows/System32/OpenSSH/ssh.exe"'
} -Scope It
}
It "Stops the service" {
$service.Status = "Running"
Mock Stop-Service { $service.Status = "Stopped" } -ParameterFilter { $Name -eq "ssh-agent" }
Stop-SshAgent
$service.Status | Should -Be "Stopped"
}
}

}