mirror of
https://github.com/kovidgoyal/kitty
synced 2026-06-06 09:15:57 +02:00
Fix debugprintln to forwarded stdio implementation
This commit is contained in:
@@ -340,16 +340,22 @@ func (self *Term) GetSize() (*unix.Winsize, error) {
|
||||
// go doesn't have a wrapper for ctermid()
|
||||
func Ctermid() string { return "/dev/tty" }
|
||||
|
||||
func DebugPrintln(a ...any) {
|
||||
var KittyStdout = utils.Once(func() *os.File {
|
||||
if fds := os.Getenv(`KITTY_STDIO_FORWARDED`); fds != "" {
|
||||
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
|
||||
return f
|
||||
}
|
||||
}
|
||||
}
|
||||
return nil
|
||||
})
|
||||
|
||||
func DebugPrintln(a ...any) {
|
||||
if f := KittyStdout(); f != nil {
|
||||
fmt.Fprintln(f, a...)
|
||||
return
|
||||
}
|
||||
term, err := OpenControllingTerm()
|
||||
if err == nil {
|
||||
defer term.Close()
|
||||
|
||||
Reference in New Issue
Block a user