Commit 1e461e3c authored by Jakob Kummerow's avatar Jakob Kummerow Committed by Commit Bot

[gm.py] Fix gm.py to work on Windows

gm.py has been careful to only use the "pty" module's functionality
on Linux, but as it turns out, the module is *so* strongly specific
to Linux that even importing it fails on Windows. Making the import
of "pty" conditional makes gm.py work on Windows.

Change-Id: I0c1fb8a9a0299fde50e252337551d9395039f14d
Reviewed-on: https://chromium-review.googlesource.com/c/1382738Reviewed-by: 's avatarMichael Lippautz <mlippautz@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58335}
parent f1cb51ad
...@@ -22,11 +22,14 @@ All arguments are optional. Most combinations should work, e.g.: ...@@ -22,11 +22,14 @@ All arguments are optional. Most combinations should work, e.g.:
from __future__ import print_function from __future__ import print_function
import errno import errno
import os import os
import pty
import re import re
import subprocess import subprocess
import sys import sys
USE_PTY = "linux" in sys.platform
if USE_PTY:
import pty
BUILD_TARGETS_TEST = ["d8", "cctest", "unittests"] BUILD_TARGETS_TEST = ["d8", "cctest", "unittests"]
BUILD_TARGETS_ALL = ["all"] BUILD_TARGETS_ALL = ["all"]
...@@ -258,7 +261,7 @@ class Config(object): ...@@ -258,7 +261,7 @@ class Config(object):
targets = " ".join(self.targets) targets = " ".join(self.targets)
# The implementation of mksnapshot failure detection relies on # The implementation of mksnapshot failure detection relies on
# the "pty" module and GDB presence, so skip it on non-Linux. # the "pty" module and GDB presence, so skip it on non-Linux.
if "linux" not in sys.platform: if not USE_PTY:
return _Call("autoninja -C %s %s" % (path, targets)) return _Call("autoninja -C %s %s" % (path, targets))
return_code, output = _CallWithOutput("autoninja -C %s %s" % return_code, output = _CallWithOutput("autoninja -C %s %s" %
......
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