Commit d7c06697 authored by Jacob Vosmaer's avatar Jacob Vosmaer

Make sure Go closes all pipes

parent 9d938369
...@@ -107,6 +107,7 @@ func handle_get_info_refs(user string, _ string, path string, w http.ResponseWri ...@@ -107,6 +107,7 @@ func handle_get_info_refs(user string, _ string, path string, w http.ResponseWri
fail_500(w, err) fail_500(w, err)
return return
} }
defer stdout.Close()
if err := cmd.Start(); err != nil { if err := cmd.Start(); err != nil {
fail_500(w, err) fail_500(w, err)
return return
...@@ -156,11 +157,13 @@ func handle_post_rpc(user string, rpc string, path string, w http.ResponseWriter ...@@ -156,11 +157,13 @@ func handle_post_rpc(user string, rpc string, path string, w http.ResponseWriter
fail_500(w, err) fail_500(w, err)
return return
} }
defer stdout.Close()
stdin, err := cmd.StdinPipe() stdin, err := cmd.StdinPipe()
if err != nil { if err != nil {
fail_500(w, err) fail_500(w, err)
return return
} }
defer stdin.Close()
if err := cmd.Start(); err != nil { if err := cmd.Start(); err != nil {
fail_500(w, err) fail_500(w, err)
return return
......
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