Commit f6349645 authored by alokp@chromium.org's avatar alokp@chromium.org

Fix presubmit checks when --trybot-json flag is specified.

Must change current working directory to the presubmit file's directory
to follow the contract of the presubmit scripts.

BUG=348691

Review URL: https://codereview.chromium.org/181063021

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@254618 0039d316-1c4b-4281-b951-d872f2087c98
parent 2ddad2c0
......@@ -1020,10 +1020,14 @@ class GetTrySlavesExecuter(object):
A list of try slaves.
"""
context = {}
main_path = os.getcwd()
try:
os.chdir(os.path.dirname(presubmit_path))
exec script_text in context
except Exception, e:
raise PresubmitFailure('"%s" had an exception.\n%s' % (presubmit_path, e))
finally:
os.chdir(main_path)
function_name = 'GetPreferredTrySlaves'
if function_name in context:
......
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