mirror of
https://github.com/ipfs/kubo.git
synced 2025-08-06 19:44:01 +08:00
19 lines
447 B
Go
19 lines
447 B
Go
package util
|
|
|
|
import "golang.org/x/sys/windows"
|
|
|
|
func InsideGUI() bool {
|
|
conhostInfo := &windows.ConsoleScreenBufferInfo{}
|
|
if err := windows.GetConsoleScreenBufferInfo(windows.Stdout, conhostInfo); err != nil {
|
|
return false
|
|
}
|
|
|
|
if (conhostInfo.CursorPosition.X | conhostInfo.CursorPosition.Y) == 0 {
|
|
// console cursor has not moved prior to our execution
|
|
// high probability that we're not in a terminal
|
|
return true
|
|
}
|
|
|
|
return false
|
|
}
|