Created
August 26, 2011 07:21
-
-
Save skull-squadron/1172895 to your computer and use it in GitHub Desktop.
Better subprocess.call
This file contains hidden or 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
import subprocess | |
def better_call(args, check=False): | |
try: | |
if check: | |
return subprocess.check_call(args) | |
else: | |
return subprocess.call(args) | |
except: | |
# Fix: Ctrl-C while reading a password (stty -echo) doesn't restore stty echo. | |
subprocess.call('stty echo', shell=True) | |
raise |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment