Fix fd leak in debugprintln

This commit is contained in:
Kovid Goyal 2023-07-24 13:56:27 +05:30
parent a5ea12757e
commit d46590c2e6
No known key found for this signature in database
GPG key ID: 06BC317B515ACE7C

View file

@ -345,6 +345,7 @@ func DebugPrintln(a ...any) {
if fd, err := strconv.Atoi(fds); err == nil && fd > -1 {
if f := os.NewFile(uintptr(fd), "<kitty_stdout>"); f != nil {
fmt.Fprintln(f, a...)
f.Close()
return
}
}