Skip to content

Instantly share code, notes, and snippets.

@vayn
Created December 11, 2014 14:01
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save vayn/3d4468069edae7e3115f to your computer and use it in GitHub Desktop.
Save vayn/3d4468069edae7e3115f to your computer and use it in GitHub Desktop.
import sys
import subprocess
from time import sleep
cmd = ['top', '-l 0']
p = subprocess.Popen(cmd, stdout=subprocess.PIPE, stderr=subprocess.STDOUT)
for line in iter(p.stdout.readline, b''):
sys.stdout.write("\r" + line.decode().replace('\n', ''))
sys.stdout.flush()
sleep(1)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment