From b0c69e87e1a82fee5b0f0d9051efa8f45bd804fa Mon Sep 17 00:00:00 2001 From: YAMASAKI Masahide Date: Fri, 6 Sep 2024 08:28:25 +0900 Subject: [PATCH] fix --- cmd/wsl2-ssh-agent-proxy/main.go | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/cmd/wsl2-ssh-agent-proxy/main.go b/cmd/wsl2-ssh-agent-proxy/main.go index 76bfacf..a5956fd 100644 --- a/cmd/wsl2-ssh-agent-proxy/main.go +++ b/cmd/wsl2-ssh-agent-proxy/main.go @@ -312,21 +312,18 @@ func main() { ps := NewPwshIOStream(exePath) defer ps.killPwsh() go ps.sigStopWorker() + listener, err := net.Listen("unix", socketPath) + if err != nil { + log.Println("Error creating Unix domain socket:", err) + return + } + defer listener.Close() for { // Start PowerShell process ctx, cancel := context.WithCancel(context.Background()) ps.setCancel(cancel) go ps.startPowerShellProces(ctx) - - // Handle kill signals - log.Printf("listen socket:%s", socketPath) - listener, err := net.Listen("unix", socketPath) - if err != nil { - log.Println("Error creating Unix domain socket:", err) - return - } - defer listener.Close() ps.listenLoop(ctx, listener) cancel() }