Commit bd2a9b97 authored by thakis@chromium.org's avatar thakis@chromium.org

Make git cl format work on my Windows box.

For me, PATH was a unicode instead of a str for some reason, so things
failed with

D:\src\chromefetch\src>git cl format
Traceback (most recent call last):
  File "d:\src\depot_tools\git_cl.py", line 2821, in <module>
    sys.exit(main(sys.argv[1:]))
  File "d:\src\depot_tools\git_cl.py", line 2807, in main
    return dispatcher.execute(OptionParser(), argv)
  File "d:\src\depot_tools\subcommand.py", line 245, in execute
    return command(parser, args[1:])
  File "d:\src\depot_tools\git_cl.py", line 2768, in CMDformat
    stdout = RunCommand(cmd, stdin=diff_output, cwd=top_dir, env=env)
  File "d:\src\depot_tools\git_cl.py", line 81, in RunCommand
    return subprocess2.check_output(args, shell=False, **kwargs)
  File "d:\src\depot_tools\subprocess2.py", line 515, in check_output
    return check_call_out(args, stdout=PIPE, **kwargs)[0]
  File "d:\src\depot_tools\subprocess2.py", line 475, in check_call_out
    out, returncode = communicate(args, **kwargs)
  File "d:\src\depot_tools\subprocess2.py", line 449, in communicate
    proc = Popen(args, **kwargs)
  File "d:\src\depot_tools\subprocess2.py", line 237, in __init__
    super(Popen, self).__init__(args, **kwargs)
  File "d:\src\depot_tools\python276_bin\lib\subprocess.py", line 709, in __init__
    errread, errwrite)
  File "d:\src\depot_tools\python276_bin\lib\subprocess.py", line 957, in _execute_child
    startupinfo)
TypeError: environment can only contain strings
Sending crash report ...
  args: ['d:\\src\\depot_tools\\git_cl.py', 'format']
  cwd: D:\src\chromefetch\src
  exception: environment can only contain strings
  host: THAKIS1-W.ad.corp.google.com
  stack:   File "d:\src\depot_tools\git_cl.py", line 2821,
  user: thakis
  version: 2.7.6 (default, Nov 10 2013, 19:24:18)

This fixes the glitch.

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@291825 0039d316-1c4b-4281-b951-d872f2087c98
parent bbe9cc5a
......@@ -2754,7 +2754,7 @@ def CMDformat(parser, args):
sys.stdout.write(stdout)
else:
env = os.environ.copy()
env['PATH'] = os.path.dirname(clang_format_tool)
env['PATH'] = str(os.path.dirname(clang_format_tool))
# diff_output is a patch to send to clang-format-diff.py
try:
script = clang_format.FindClangFormatScriptInChromiumTree(
......
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