Skip to content

Commit

Permalink
Do not close nil stream
Browse files Browse the repository at this point in the history
  • Loading branch information
joecorall authored Oct 17, 2024
1 parent 2221f5b commit d114727
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions server.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,8 +76,10 @@ func (s *Server) MessageHandler(w http.ResponseWriter, r *http.Request) {
http.Error(w, cases.Title(language.English).String(fmt.Sprint(err)), errCode)
return
}
defer fs.Close()
cmd.Stdin = fs
if fs != nil {
defer fs.Close()
cmd.Stdin = fs
}

// Create a buffer to capture stderr
var stdErr bytes.Buffer
Expand Down

0 comments on commit d114727

Please sign in to comment.