fix panic on failure starting plugin server

Signed-off-by: Nicolas De Loof <nicolas.deloof@gmail.com>
This commit is contained in:
Nicolas De Loof 2025-06-06 18:24:07 +02:00 committed by Guillaume Lours
parent 1d34661e91
commit 63b06f5563
2 changed files with 1 additions and 3 deletions

View File

@ -295,9 +295,8 @@ func (s *composeService) doBuildBake(ctx context.Context, project *types.Project
// Use docker/cli mechanism to propagate termination signal to child process
server, err := socket.NewPluginServer(nil)
if err != nil {
if err == nil {
defer server.Close() //nolint:errcheck
cmd.Cancel = server.Close
cmd.Env = replace(cmd.Env, socket.EnvKey, server.Addr().String())
}

View File

@ -207,7 +207,6 @@ func (s *composeService) setupPluginCommand(ctx context.Context, project *types.
server, err := socket.NewPluginServer(nil)
if err == nil {
defer server.Close() //nolint:errcheck
cmd.Cancel = server.Close
cmd.Env = replace(cmd.Env, socket.EnvKey, server.Addr().String())
}