X-Git-Url: https://ruderich.org/simon/gitweb/?a=blobdiff_plain;f=cmd%2Fsafcm-remote%2Fmain.go;h=e9ce1cd0ccac627e6573bc5b07c040166cb4be65;hb=12cc10aa34b77855b1dccec4dbc9183cf03fa9af;hp=bf5159f0c89e9fa3d7c1dd904ff9a8476a4ba4ef;hpb=2a08d176811fe8adf95234dc3c0d9a7eb7539e8a;p=safcm%2Fsafcm.git diff --git a/cmd/safcm-remote/main.go b/cmd/safcm-remote/main.go index bf5159f..e9ce1cd 100644 --- a/cmd/safcm-remote/main.go +++ b/cmd/safcm-remote/main.go @@ -22,6 +22,8 @@ import ( "log" "os" + "golang.org/x/term" + "ruderich.org/simon/safcm" "ruderich.org/simon/safcm/cmd/safcm-remote/ainsl" "ruderich.org/simon/safcm/cmd/safcm-remote/info" @@ -62,6 +64,12 @@ func main() { } func mainLoop() error { + if term.IsTerminal(int(os.Stdin.Fd())) || + term.IsTerminal(int(os.Stdout.Fd())) { + return fmt.Errorf("sync should only be called from `safcm` " + + "(redirect stdin/stdout to circumvent this check)") + } + conn := safcm.NewGobConn(os.Stdin, os.Stdout) var logLevel safcm.LogLevel