summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gotop/main.go11
1 files changed, 11 insertions, 0 deletions
diff --git a/gotop/main.go b/gotop/main.go
index 0af15f3..470d616 100644
--- a/gotop/main.go
+++ b/gotop/main.go
@@ -14,6 +14,7 @@ import (
"log"
"os"
"os/signal"
+ "os/user"
"syscall"
"time"
)
@@ -247,6 +248,16 @@ func main() {
os.Exit(0)
}()
+ user, err := user.Current()
+ if err != nil {
+ log.Fatal(err)
+ }
+
+ if user.Username != "root" {
+ fmt.Println("Warning: You are not root, so you will not see everything!")
+ time.Sleep(time.Duration(2) * time.Second)
+ }
+
for {
tChan <- true
time.Sleep(config.interval)