Created
September 2, 2015 23:05
-
-
Save mcclure/617b038464f300ca802d to your computer and use it in GitHub Desktop.
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/python | |
# NOTE: BEFORE EXECUTING, REPLACE THE PATH IN cwd= IN THE FINAL LINE. | |
import subprocess | |
import copy | |
import os | |
globalEnv = copy.deepcopy( os.environ ) | |
globalEnv["HGPLAIN"]="1" # Disable pager, etc in any following calls | |
def fullExec(cmd, cwd=None, env=None): | |
proc = subprocess.Popen(cmd, cwd=cwd, stdout=subprocess.PIPE, stderr=subprocess.PIPE,env=env if env else globalEnv) | |
result = proc.wait() | |
outstr, errstr = proc.communicate() | |
return bool(result),outstr,errstr | |
print "Going in" | |
fullExec(['hg', 'log'], cwd="/Users/mcc/work/h/test-emily-game") | |
# Expected behavior: Script completes | |
# Observed behavior: Script does not complete?! | |
# Invoking `HGPLAIN=1 hg log` in the cwd directory terminates just fine. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment