fix to power display

This commit is contained in:
alu
2026-08-04 14:20:23 -07:00
parent 04b4f53092
commit 16495b403b
5 changed files with 62 additions and 56 deletions
+10 -2
View File
@@ -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