Chromium Code Reviews| Index: slave/run_slave.py |
| diff --git a/slave/run_slave.py b/slave/run_slave.py |
| index 72c5021ec502f20334d466093b1d046b363e5c9a..765528f828724b2e69928698864b496fe3fa3895 100755 |
| --- a/slave/run_slave.py |
| +++ b/slave/run_slave.py |
| @@ -57,7 +57,7 @@ def IssueReboot(): |
| 'for %s' % sys.platform) |
| -def SigTerm(*args): |
| +def SigTerm(*_args): |
| """Receive a SIGTERM and do nothing.""" |
| Log('SigTerm: Received SIGTERM, doing nothing.') |
| @@ -433,8 +433,15 @@ def main(): |
| os.environ['CHROME_HEADLESS'] = '1' |
| os.environ['PAGER'] = 'cat' |
| - # Platform-specific initialization. |
| + # Get the current PATH. |
| + path_elements = os.environ['PATH'].split(os.pathsep) |
| + def get_path_element(phrase): |
|
hinoka
2016/06/23 22:17:55
This function does something pretty unexpected (to
dnj (Google)
2016/06/24 03:24:51
Done.
|
| + for e in path_elements: |
| + if phrase in e: |
|
Ryan Tseng
2016/06/23 16:45:30
if phrase in e.listdir()?
dnj (Google)
2016/06/24 03:24:51
"e" is a string here.
|
| + return [e] |
| + return [] |
| + # Platform-specific initialization. |
| if sys.platform.startswith('win'): |
| # list of all variables that we want to keep |
| env_var = [ |
| @@ -484,7 +491,8 @@ def main(): |
| remove_all_vars_except(os.environ, env_var) |
| - # Extend the env variables with the chrome-specific settings. |
| + # Extend the env variables with the chrome-specific settings. Tailor the |
| + # slave process' (and derivative tasks') PATH environment variable. |
| slave_path = [ |
| depot_tools, |
| # Reuse the python executable used to start this script. |
| @@ -497,6 +505,10 @@ def main(): |
| # TODO(hinoka): Remove this when its no longer needed crbug.com/481695 |
| os.path.join(os.environ['SYSTEMDRIVE'], os.sep, 'cmake', 'bin'), |
| ] |
| + |
| + # Include Windows PowerShell in PATH, if defined. |
|
hinoka
2016/06/23 22:17:55
# It does so by searching for a path entry that co
dnj (Google)
2016/06/24 03:24:51
Done.
|
| + slave_path += get_path_element('WindowsPowerShell') |
| + |
| # build_internal/tools contains tools we can't redistribute. |
| tools = os.path.join(ROOT_DIR, 'build_internal', 'tools') |
| if os.path.isdir(tools): |