Commit fc127acd authored by scottmg@google.com's avatar scottmg@google.com

Fix lastchange.py when running on native win32 python

When running as runhooks, it's not run via cygwin like it was when run in the build, and isn't able to find git. I believe the test that checked for both cygwin and win32 before was incorrect (but was always run via cygwin before so didn't matter).

Additionally, when runhooks runs it, it's from above src/, so the cwd isn't in the repo. So, pass in the directory of the script itself so that git can find its repo.

BUG=112264

Committed: https://src.chromium.org/viewvc/chrome?view=rev&revision=120089

Review URL: https://chromiumcodereview.appspot.com/9317037

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@120110 0039d316-1c4b-4281-b951-d872f2087c98
parent b8bdc427
......@@ -73,20 +73,18 @@ def RunGitCommand(directory, command):
A process object or None.
"""
command = ['git'] + command
shell = True
# Force shell usage under cygwin. This is a workaround for
# mysterious loss of cwd while invoking cygwin's git.
# We can't just pass shell=True to Popen, as under win32 this will
# cause CMD to be used, while we explicitly want a cygwin shell.
if sys.platform == 'cygwin':
command = ['sh', '-c', ' '.join(command)]
shell = False
try:
proc = subprocess.Popen(command,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
cwd=directory,
shell=shell)
shell=(sys.platform=='win32'))
return proc
except OSError:
return None
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment