Skip to content

Instantly share code, notes, and snippets.

Created Dec 11, 2014
What would you like to do?
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', ''))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment