Skip to content
This repository was archived by the owner on Mar 15, 2020. It is now read-only.

Commit 569999b

Browse files
committed
Add 1sec delay after sending SEGTERM to ssh-agent to allow proper child cleanup
1 parent 0ec0b1b commit 569999b

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

linux/main.c

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -796,7 +796,7 @@ main(int argc, char *argv[])
796796
return 0;
797797

798798
case 'v':
799-
printf("ssh-agent-wsl 2.3\n");
799+
printf("ssh-agent-wsl 2.4\n");
800800
printf("Based on weasel-pageant, copyright 2017, 2018 Valtteri Vuorikoski\n");
801801
printf("Based on ssh-pageant, copyright 2009-2014 Josh Stone\n");
802802
printf("License GPLv3+: GNU GPL version 3 or later"
@@ -871,13 +871,19 @@ main(int argc, char *argv[])
871871
pid = atoi(pidenv);
872872
if (kill(pid, SIGTERM) < 0)
873873
err(1, "kill(%d)", pid);
874+
875+
#if !REAL_DAEMONIZE
876+
// wait a bit here, so helper could properly die, otherwise WSL gets confused and starts consuming CPU...
877+
sleep(1);
878+
#endif
879+
874880
output_unset_env(opt_sh);
875881
if (!opt_quiet)
876882
if (!strcasecmp((const char*)program_invocation_short_name, "ssh-agent")) {
877883
// Make sure output is compatible with openssh
878884
printf("echo Agent pid %d killed;\n", pid);
879885
} else {
880-
printf("echo ssh-agent-wsl pid killed%d;\n", pid);
886+
printf("echo ssh-agent-wsl pid %s killed;\n", pid);
881887
}
882888
return 0;
883889
}

0 commit comments

Comments
 (0)