From: Russ Cox Date: Thu, 15 Jul 2010 23:43:06 +0000 (-0700) Subject: codereview: don't run gofmt with an empty file list X-Git-Tag: weekly.2010-07-29~91 X-Git-Url: http://www.git.cypherpunks.su/?a=commitdiff_plain;h=ad665e4fde1878dbc8d3893bf8b4ddbe2f83ccff;p=gostls13.git codereview: don't run gofmt with an empty file list R=gri CC=golang-dev https://golang.org/cl/1678054 --- diff --git a/lib/codereview/codereview.py b/lib/codereview/codereview.py index 750ae871ca..4aeff90678 100644 --- a/lib/codereview/codereview.py +++ b/lib/codereview/codereview.py @@ -694,6 +694,8 @@ def CheckGofmt(ui, repo, files, just_warn=False): cwd = os.getcwd() files = [RelativePath(repo.root + '/' + f, cwd) for f in files] files = [f for f in files if os.access(f, 0)] + if not files: + return try: cmd = subprocess.Popen(["gofmt", "-l"] + files, shell=False, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, close_fds=True) cmd.stdin.close()