I use ActiveWindowGet command to get currently active process. It runs perfectly. But if user starts the app with sudo, following part makes Panic and it crashes my entire app.
XGB: conn.go:47: Could not get authority info: open /root/.Xauthority: no such file or directory
XGB: conn.go:48: Trying connection without authority info...
panic: runtime error: invalid memory address or nil pointer dereference
[signal SIGSEGV: segmentation violation code=0x1 addr=0x20 pc=0xb48834]
goroutine 101 [running]:
github.com/BurntSushi/xgbutil/ewmh.ActiveWindowGet(0x7f4ce5424a68?)
/github.com/BurntSushi/xgbutil/ewmh/ewmh.go:33 +0x14
So my questions would be:
Can we handle panic here and return an error to user
Is it possible to use ActiveWindowGet with sudo?
Thanks!
Edit: Oh, I'm sorry, totally my mistake. NewConn was giving an error but I didn't check that.
Closing the issue, sorry for the mistake.
I use ActiveWindowGet command to get currently active process. It runs perfectly. But if user starts the app with sudo, following part makes Panic and it crashes my entire app.
So my questions would be:
Thanks!
Edit: Oh, I'm sorry, totally my mistake. NewConn was giving an error but I didn't check that. Closing the issue, sorry for the mistake.