fix to power display
This commit is contained in:
+10
-2
@@ -2,6 +2,7 @@ package app
|
||||
|
||||
import (
|
||||
"finally-a-monolithic-linux-hw-monitor/app/cpu"
|
||||
"finally-a-monolithic-linux-hw-monitor/app/cpu/proc"
|
||||
"fmt"
|
||||
"os"
|
||||
"os/signal"
|
||||
@@ -24,13 +25,20 @@ func Run() {
|
||||
os.Exit(0)
|
||||
}()
|
||||
|
||||
proc, err := proc.GetProc()
|
||||
|
||||
ticker := time.NewTicker(1 * time.Second)
|
||||
defer ticker.Stop()
|
||||
for {
|
||||
console := &strings.Builder{}
|
||||
cpu.RenderCPU(console)
|
||||
|
||||
console.WriteString("\nPress Ctrl+C to exit.\033[K\n")
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
cpu.RenderCPU(console, &proc)
|
||||
|
||||
fmt.Fprint(console, "\nPress Ctrl+C to exit.\033[K\n")
|
||||
fmt.Print(console.String())
|
||||
|
||||
<-ticker.C
|
||||
|
||||
Reference in New Issue
Block a user