diff --git a/devlib/host.py b/devlib/host.py index ccf66e0..ecf724d 100644 --- a/devlib/host.py +++ b/devlib/host.py @@ -104,7 +104,7 @@ class LocalConnection(ConnectionBase): command = 'echo {} | sudo -S -- sh -c '.format(quote(password)) + quote(command) ignore = None if check_exit_code else 'all' try: - return check_output(command, shell=True, timeout=timeout, ignore=ignore)[0] + stdout, stderr = check_output(command, shell=True, timeout=timeout, ignore=ignore) except subprocess.CalledProcessError as e: message = 'Got exit code {}\nfrom: {}\nOUTPUT: {}'.format( e.returncode, command, e.output) @@ -112,6 +112,7 @@ class LocalConnection(ConnectionBase): raise TargetTransientError(message) else: raise TargetStableError(message) + return stdout + stderr def background(self, command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, as_root=False): if as_root and not self.connected_as_root: