From c30a6232df03e1efbd9f3b226777b07e087a1122 Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Mon, 12 Oct 2020 14:27:29 +0200 Subject: BASELINE: Update Chromium to 85.0.4183.140 Change-Id: Iaa42f4680837c57725b1344f108c0196741f6057 Reviewed-by: Allan Sandfeld Jensen --- chromium/build/fuchsia/remote_cmd.py | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) (limited to 'chromium/build/fuchsia/remote_cmd.py') diff --git a/chromium/build/fuchsia/remote_cmd.py b/chromium/build/fuchsia/remote_cmd.py index 93ce32ce287..019c2dc9abd 100644 --- a/chromium/build/fuchsia/remote_cmd.py +++ b/chromium/build/fuchsia/remote_cmd.py @@ -5,7 +5,6 @@ import logging import os import subprocess -import sys import threading _SSH = ['ssh'] @@ -57,31 +56,36 @@ class CommandRunner(object): _SSH_LOGGER.debug('ssh exec: ' + ' '.join(ssh_command)) if silent: devnull = open(os.devnull, 'w') - process = subprocess.Popen(ssh_command, stderr=devnull, stdout=devnull) + process = subprocess.Popen(ssh_command, stdout=devnull, stderr=devnull) else: - process = subprocess.Popen(ssh_command) + process = subprocess.Popen(ssh_command, stdout=subprocess.PIPE, + stderr=subprocess.STDOUT) timeout_timer = None if timeout_secs: timeout_timer = threading.Timer(timeout_secs, process.kill) timeout_timer.start() - process.wait() + if not silent: + for line in process.stdout: + print(line) + process.wait() if timeout_timer: timeout_timer.cancel() - if process.returncode == -9: raise Exception('Timeout when executing \"%s\".' % ' '.join(command)) return process.returncode - def RunCommandPiped(self, command = None, ssh_args = None, **kwargs): + def RunCommandPiped(self, command, stdout, stderr, ssh_args = None, **kwargs): """Executes an SSH command on the remote host and returns a process object with access to the command's stdio streams. Does not block. command: A list of strings containing the command and its arguments. + stdout: subprocess stdout. Must not be None. + stderr: subprocess stderr. Must not be None. ssh_args: Arguments that will be passed to SSH. kwargs: A dictionary of parameters to be passed to subprocess.Popen(). The parameters can be used to override stdin and stdout, for @@ -89,14 +93,15 @@ class CommandRunner(object): Returns a Popen object for the command.""" - if not command: - command = [] + if not stdout or not stderr: + raise Exception('Stdout/stderr must be specified explicitly') + if not ssh_args: ssh_args = [] ssh_command = self._GetSshCommandLinePrefix() + ssh_args + ['--'] + command _SSH_LOGGER.debug(' '.join(ssh_command)) - return subprocess.Popen(ssh_command, **kwargs) + return subprocess.Popen(ssh_command, stdout=stdout, stderr=stderr, **kwargs) def RunScp(self, sources, dest, direction, recursive=False): -- cgit v1.2.1