[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/1382738
Reviewed-by: Michael Lippautz <mlippautz@chromium.org>
Commit-Queue: Jakob Kummerow <jkummerow@chromium.org>
Cr-Commit-Position: refs/heads/master@{#58335}
This commit is contained in:
Jakob Kummerow 2018-12-18 17:21:34 +01:00 committed by Commit Bot
parent f1cb51ad4e
commit 1e461e3c5e

View File

@ -22,11 +22,14 @@ All arguments are optional. Most combinations should work, e.g.:
from __future__ import print_function
import errno
import os
import pty
import re
import subprocess
import sys
USE_PTY = "linux" in sys.platform
if USE_PTY:
import pty
BUILD_TARGETS_TEST = ["d8", "cctest", "unittests"]
BUILD_TARGETS_ALL = ["all"]
@ -258,7 +261,7 @@ class Config(object):
targets = " ".join(self.targets)
# The implementation of mksnapshot failure detection relies on
# 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_code, output = _CallWithOutput("autoninja -C %s %s" %