Commit 6593d933 authored by ppi@chromium.org's avatar ppi@chromium.org

Fix `git cl format` for dart code.

The part that runs dartfmt was relying on the part that runs (or not)
Clang to set the |env| local variable, which no longer happens after
https://codereview.chromium.org/1734863002, making `git cl format` fail
with:

Traceback (most recent call last):
  File "/usr/local/google/home/ppi/projects/depot_tools/git_cl.py", line 3957, in <module>
    sys.exit(main(sys.argv[1:]))
  File "/usr/local/google/home/ppi/projects/depot_tools/git_cl.py", line 3939, in main
    return dispatcher.execute(OptionParser(), argv)
  File "/usr/local/work/depot_tools/subcommand.py", line 252, in execute
    return command(parser, args[1:])
  File "/usr/local/google/home/ppi/projects/depot_tools/git_cl.py", line 3837, in CMDformat
    stdout = RunCommand(command, cwd=top_dir, env=env)
UnboundLocalError: local variable 'env' referenced before assignment

It seems that we don't need to override env for dartfm anyway - the
clang part is doing this to put clang_format_tool in PATH.

This patch just drops env= from RunCommand for dartfmt.

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

git-svn-id: svn://svn.chromium.org/chrome/trunk/tools/depot_tools@299072 0039d316-1c4b-4281-b951-d872f2087c98
parent b4f6a229
......@@ -3834,7 +3834,7 @@ def CMDformat(parser, args):
command.append('-w')
command.extend(dart_diff_files)
stdout = RunCommand(command, cwd=top_dir, env=env)
stdout = RunCommand(command, cwd=top_dir)
if opts.dry_run and stdout:
return_value = 2
except dart_format.NotFoundError as e:
......
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