Commit 8cb3a69a authored by Jacob Vosmaer's avatar Jacob Vosmaer

Prevent archive zombies

Episode V: The Archive Zombies Strike Back
parent 607825c5
......@@ -14,6 +14,7 @@ import (
"os/exec"
"path"
"path/filepath"
"syscall"
"time"
)
......@@ -79,6 +80,7 @@ func handleGetArchive(w http.ResponseWriter, r *gitRequest) {
stdout = archiveStdout
} else {
compressCmd.Stdin = archiveStdout
compressCmd.SysProcAttr = &syscall.SysProcAttr{Setpgid: true}
stdout, err = compressCmd.StdoutPipe()
if err != nil {
......@@ -91,7 +93,7 @@ func handleGetArchive(w http.ResponseWriter, r *gitRequest) {
fail500(w, fmt.Errorf("handleGetArchive: start %v: %v", compressCmd.Args, err))
return
}
defer compressCmd.Wait()
defer cleanUpProcessGroup(compressCmd)
archiveStdout.Close()
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment