Bug 1585565 - [lint.eslint] Work around mozprocess Windows + Python 3 bug, r=Gijs
authorAndrew Halberstadt <ahalberstadt@mozilla.com>
Wed, 02 Oct 2019 15:45:34 +0000
changeset 496060 50f95869c616eeb9db9c1cceaf9dc7df93f8cda7
parent 496059 9468067f683bf8f4f268a7239741217f659300e4
child 496061 5591af7fd2839f6a84736c9d133f1b8b7279c55a
push id36641
push userdvarga@mozilla.com
push dateWed, 02 Oct 2019 21:43:49 +0000
treeherdermozilla-central@c9c63f844702 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
reviewersGijs
bugs1585565
milestone71.0a1
first release with
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
last release without
nightly linux32
nightly linux64
nightly mac
nightly win32
nightly win64
Bug 1585565 - [lint.eslint] Work around mozprocess Windows + Python 3 bug, r=Gijs Differential Revision: https://phabricator.services.mozilla.com/D47925
tools/lint/eslint/__init__.py
--- a/tools/lint/eslint/__init__.py
+++ b/tools/lint/eslint/__init__.py
@@ -85,16 +85,25 @@ def lint(paths, config, binary=None, fix
     shell = False
     if os.environ.get('MSYSTEM') in ('MINGW32', 'MINGW64'):
         # The eslint binary needs to be run from a shell with msys
         shell = True
 
     orig = signal.signal(signal.SIGINT, signal.SIG_IGN)
     proc = ProcessHandler(cmd_args, env=os.environ, stream=None,
                           shell=shell, universal_newlines=True)
+
+    if sys.platform == 'win32':
+        # Workaround for bug 1585702. According to the win32 docs,
+        # CreateProcess will use the calling process's env by default. Since we
+        # are passing in `os.environ` wholesale anyway, setting the env to
+        # `None` shouldn't make a difference. An alternative workaround would
+        # be to stop using mozprocess here and use subprocess directly.
+        proc.env = None
+
     proc.run()
     signal.signal(signal.SIGINT, orig)
 
     try:
         proc.wait()
     except KeyboardInterrupt:
         proc.kill()
         return []