Skip to content

Commit 901dc27

Browse files
committed
hostagent: Fix: ha.sock was not removed on exit
Change to close the `http.Server` explicitly, and it will close the `net.UnixListener`. The `net.UnixListener` will then unlink `ha.socket` on close. Signed-off-by: Norio Nomura <norio.nomura@gmail.com>
1 parent e49e987 commit 901dc27

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

cmd/limactl/hostagent.go

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,12 +125,11 @@ func hostagentAction(cmd *cobra.Command, args []string) error {
125125
return err
126126
}
127127
go func() {
128-
defer os.RemoveAll(socket)
129-
defer srv.Close()
130128
if serveErr := srv.Serve(l); serveErr != http.ErrServerClosed {
131129
logrus.WithError(serveErr).Warn("hostagent API server exited with an error")
132130
}
133131
}()
132+
defer srv.Close()
134133
return ha.Run(cmd.Context())
135134
}
136135

0 commit comments

Comments
 (0)