From: Earl Ou Date: Mon, 5 Oct 2020 07:29:51 +0000 (+0800) Subject: scons: avoid interactive access in non-tty X-Git-Tag: develop-gem5-snapshot~689 X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=2286384a03e9637059f61beeac863593a183d558;p=gem5.git scons: avoid interactive access in non-tty We saw some strange behavior when building scons without an interactive TTY. This seems be caused by the control signal set from curses.initscr() and endwin(). To avoid issues, we should avoid those operation when running in non interactive situation. Change-Id: I9cf8e48a786d47d567ba193f0b069f638e8db647 Reviewed-on: https://gem5-review.googlesource.com/c/public/gem5/+/35595 Reviewed-by: Gabe Black Maintainer: Gabe Black Tested-by: kokoro --- diff --git a/site_scons/gem5_scons/__init__.py b/site_scons/gem5_scons/__init__.py index 169e0fe06..33231127c 100644 --- a/site_scons/gem5_scons/__init__.py +++ b/site_scons/gem5_scons/__init__.py @@ -41,6 +41,7 @@ from __future__ import print_function import os +import sys import textwrap from gem5_scons.util import get_termcap @@ -131,6 +132,10 @@ class Transform(object): # The width warning and error messages should be wrapped at. text_width = None +# If stdout is not attached to a terminal, default to 80 columns. +if not sys.stdout.isatty(): + text_width = 80 + # This should work in python 3.3 and above. if text_width is None: try: