c93630ece1ee9b1811dbfefc7c27ddc3c222cf10

Author
Ayman Bagabas <ayman.bagabas@gmail.com>
Committer
Ayman Bagabas <ayman.bagabas@gmail.com>
Date

Message

fix(server): wait for and ensure git command exits

We have to wait for exec.Command to exit

Fixes: https://github.com/charmbracelet/soft-serve/issues/262

Diff

 1diff --git a/server/git/git.go b/server/git/git.go
 2index 5a49b3dc41f7e71b488ec3f511d1d665aa2a3a29..0b14f0b5031901b2b4299d87981f43134509edb9 100644
 3--- a/server/git/git.go
 4+++ b/server/git/git.go
 5@@ -136,11 +136,11 @@ func RunGit(ctx context.Context, in io.Reader, out io.Writer, er io.Writer, dir
 6 	})
 7 
 8 	if err := errg.Wait(); err != nil {
 9-		logger.Error("while running git command", "err", err)
10-		return err
11+		logger.Error("while copying output", "err", err)
12 	}
13 
14-	return nil
15+	// Wait for the command to finish
16+	return c.Wait()
17 }
18 
19 // WritePktline encodes and writes a pktline to the given writer.