Adjusted the code regarding to wimh's comment. Now the SSH_AGENT is killed on application exit

This commit is contained in:
Konstantinos Vaggelakos 2011-10-29 19:26:42 +02:00
parent 3658bbb3aa
commit ce2f8b99f5

View file

@ -1148,13 +1148,10 @@ namespace SparkleShare {
#else
System.Windows.Forms.Application.Exit ();
// Also kill the SSH_AGENT
// Also kill the SSH_AGENT that we started
try {
// Check if we created the process, if so bring it down. Else leave it running
if (!System.Environment.GetEnvironmentVariable ("SSH_AUTH_SOCK").Equals ("unknown")) {
int pid = Int32.Parse (System.Environment.GetEnvironmentVariable ("SSH_AGENT_PID"));
Process.GetProcessById (pid).Kill ();
}
int pid = Int32.Parse (System.Environment.GetEnvironmentVariable ("SSH_AGENT_PID"));
Process.GetProcessById (pid).Kill ();
} catch (Exception e) {
// Handle exception if needed
}