зеркало из https://github.com/mozilla/gecko-dev.git
Bug 1195748 - Fix mach auto-logging on Windows. r=gps
We were relying on the log manager's terminal to know whether we're running on a terminal to turn on auto-logging, but the log manager's terminal is always None on Windows because blessings imports curses, which doesn't work on Windows. So instead, just use a plain os.isatty() call. The same problem also applies to the show-log command to trigger the pager (less). At the same time, fix the environment setting for LESS, as on Windows, unicode literals are not allowed in the environment. --HG-- extra : rebase_source : 1462849608c8cb86afcb080184efb50caf6d2f9e
This commit is contained in:
Родитель
27dab6f2a1
Коммит
6283835342
|
@ -755,7 +755,7 @@ class MachCommandBase(MozbuildObject):
|
|||
# Always keep a log of the last command, but don't do that for mach
|
||||
# invokations from scripts (especially not the ones done by the build
|
||||
# system itself).
|
||||
if (self.log_manager and self.log_manager.terminal and
|
||||
if (os.isatty(sys.stdout.fileno()) and
|
||||
not getattr(self, 'NO_AUTO_LOG', False)):
|
||||
self._ensure_state_subdir_exists('.')
|
||||
logfile = self._get_state_filename('last_log.json')
|
||||
|
|
|
@ -672,12 +672,12 @@ class Logs(MachCommandBase):
|
|||
path = self._get_state_filename('last_log.json')
|
||||
log_file = open(path, 'rb')
|
||||
|
||||
if self.log_manager.terminal:
|
||||
if os.isatty(sys.stdout.fileno()):
|
||||
env = dict(os.environ)
|
||||
if 'LESS' not in env:
|
||||
# Sensible default flags if none have been set in the user
|
||||
# environment.
|
||||
env['LESS'] = 'FRX'
|
||||
env[b'LESS'] = b'FRX'
|
||||
less = subprocess.Popen(['less'], stdin=subprocess.PIPE, env=env)
|
||||
# Various objects already have a reference to sys.stdout, so we
|
||||
# can't just change it, we need to change the file descriptor under
|
||||
|
|
Загрузка…
Ссылка в новой задаче