Skip to content

Commit

Permalink
ports: Colorize
Browse files Browse the repository at this point in the history
  • Loading branch information
Rosuav committed Jul 5, 2024
1 parent ceb4ea2 commit b0eb414
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion ports
Original file line number Diff line number Diff line change
Expand Up @@ -110,5 +110,9 @@ for pid in pids:
if state == "D" and "-v" in sys.argv:
print(pid, "DiskSleep", title, "ppid", ppid)
except FileNotFoundError: pass # Process must have terminated while we were searching
print("Procs", len(pids), f"({status['D']} D, {status['R']} R)")
if status["D"] > 10 or status["R"] > 30: color = "\x1b[1;31m"
elif status["D"]: color = "\x1b[1;33m"
elif status["R"] > 10: color = "\x1b[1m"
else: color = "\x1b[1;32m"
print(f"Procs {color}{len(pids)} ({status['D']} D, {status['R']} R)\x1b[0m")
sys.exit(error)

0 comments on commit b0eb414

Please sign in to comment.