Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(76)

Unified Diff: tools/gn/bin/gn-format.py

Issue 2296633003: Use shell=False on non-Windows for gn-format.py (Closed)
Patch Set: comment Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/gn/bin/gn-format.py
diff --git a/tools/gn/bin/gn-format.py b/tools/gn/bin/gn-format.py
index 4769640297f77e244ef868704213300275b399e4..561c76c828ae035eebc8277fd095d1541886ff2a 100644
--- a/tools/gn/bin/gn-format.py
+++ b/tools/gn/bin/gn-format.py
@@ -27,18 +27,19 @@ def main():
buf = vim.current.buffer
text = '\n'.join(buf)
+ is_win = sys.platform.startswith('win32')
# Avoid flashing an ugly cmd prompt on Windows when invoking gn.
startupinfo = None
- if sys.platform.startswith('win32'):
+ if is_win:
startupinfo = subprocess.STARTUPINFO()
startupinfo.dwFlags |= subprocess.STARTF_USESHOWWINDOW
startupinfo.wShowWindow = subprocess.SW_HIDE
- # Call formatter.
+ # Call formatter. Needs shell=True on Windows due to gn.bat in depot_tools.
p = subprocess.Popen([binary, 'format', '--stdin'],
stdout=subprocess.PIPE, stderr=subprocess.PIPE,
stdin=subprocess.PIPE, startupinfo=startupinfo,
- shell=True, universal_newlines=True)
+ shell=is_win, universal_newlines=True)
stdout, stderr = p.communicate(input=text)
if p.returncode != 0:
print 'Formatting failed, please report to gn-dev@chromium.org.'
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698