summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek@centricular.com>2019-03-02 05:20:42 +0530
committerNirbheek Chauhan <nirbheek@centricular.com>2019-03-02 07:53:56 +0530
commitb2a05b214a7c469c56d15be3525dd151c350f78e (patch)
treea9b370466514b40441a1fbef68f4bd3857483b75
parent6bd9a9baa8d6e7d3f8140d420eec77eeaf8bd9c4 (diff)
cerbero: Auto-detect when the console is interactive
The default setting for this should not be True. The default setting should auto-detect it. Setting it through the config continues to work as before.
-rw-r--r--cerbero/config.py2
-rw-r--r--cerbero/utils/shell.py7
2 files changed, 8 insertions, 1 deletions
diff --git a/cerbero/config.py b/cerbero/config.py
index 75574c67..8a8f1ed8 100644
--- a/cerbero/config.py
+++ b/cerbero/config.py
@@ -396,7 +396,7 @@ class Config (object):
self.set_property('recipes_remotes', {})
self.set_property('extra_build_tools', [])
self.set_property('distro_packages_install', True)
- self.set_property('interactive', True)
+ self.set_property('interactive', shell.console_is_interactive())
self.set_property('meson_cross_properties', {})
self.set_property('manifest', None)
self.set_property('extra_properties', {})
diff --git a/cerbero/utils/shell.py b/cerbero/utils/shell.py
index 5f67d983..36563f18 100644
--- a/cerbero/utils/shell.py
+++ b/cerbero/utils/shell.py
@@ -102,6 +102,13 @@ class StdOut:
def __getattr__(self, attr):
return getattr(self.stream, attr)
+def console_is_interactive():
+ if not os.isatty(sys.stdout.fileno()):
+ return False
+ if os.environ.get('TERM') == 'dumb':
+ return False
+ return True
+
def _fix_mingw_cmd(path):
reserved = ['/', ' ', '\\', ')', '(', '"']