//go:build !windows package main import ( "os" "os/exec" ) // fatalBox says why OpsLog is not starting, as visibly as the desktop allows. // // It used to be one println. That goes to stderr, and a binary started from a // file manager or a .desktop launcher has no stderr anybody will ever read — so // the refusal that was carefully worded arrived as "I click it and nothing // happens", which is the least useful thing a program can say. // // So: a real dialog when the desktop has one of the two tools that every // distribution ships with its desktop task, and stderr regardless. Neither is // required — the startup log has the same text, and nothing here is allowed to // stop OpsLog from exiting. func fatalBox(title, text string) { os.Stderr.WriteString(title + ": " + text + "\n") for _, c := range [][]string{ {"zenity", "--error", "--no-wrap", "--title", title, "--text", text}, {"kdialog", "--title", title, "--error", text}, // Neither is a hard requirement, and on a headless box there is nothing // to show a dialog on anyway. } { if _, err := exec.LookPath(c[0]); err != nil { continue } cmd := exec.Command(c[0], c[1:]...) if err := cmd.Start(); err != nil { continue } _ = cmd.Wait() return } }