From 6593d9331d8b96e0ccb1e75b7892c6a8e103bdc1 Mon Sep 17 00:00:00 2001 From: "ppi@chromium.org" Date: Thu, 3 Mar 2016 15:41:15 +0000 Subject: [PATCH] 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 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 --- git_cl.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/git_cl.py b/git_cl.py index ef974d50f..d1802cc3c 100755 --- a/git_cl.py +++ b/git_cl.py @@ -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: