Created
March 15, 2015 22:06
-
-
Save detly/22284275762bbf9c86d6 to your computer and use it in GitHub Desktop.
top failure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/usr/bin/env python2 | |
import subprocess | |
import time | |
# Start 'top' | |
the_proc = subprocess.Popen(['top'], stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE) | |
# Just kill it after a couple of seconds | |
time.sleep(2) | |
the_proc.terminate() | |
stdout, stderr = the_proc.communicate() | |
print(stdout) | |
print(stderr) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment