From bbbfc91a015bd394e0f6adbc713fa5549e66fbbe Mon Sep 17 00:00:00 2001 From: Federico Ressi Date: Fri, 5 Jul 2019 04:22:21 +0200 Subject: [PATCH] Fix shell package. Change-Id: I19eb817c7eb9a85c684c8f2f7a3735b6bde811af --- tobiko/shell/sh/_execute.py | 2 +- tobiko/shell/sh/_local.py | 2 +- tobiko/shell/sh/_process.py | 9 ++++++--- tobiko/shell/sh/_ssh.py | 2 +- 4 files changed, 9 insertions(+), 6 deletions(-) diff --git a/tobiko/shell/sh/_execute.py b/tobiko/shell/sh/_execute.py index eff731b12..32ebbf135 100644 --- a/tobiko/shell/sh/_execute.py +++ b/tobiko/shell/sh/_execute.py @@ -40,7 +40,7 @@ class ShellExecuteResult(object): def execute(command, environment=None, timeout=None, shell=None, - stdin=True, stdout=True, stderr=True, ssh_client=None, + stdin=None, stdout=None, stderr=None, ssh_client=None, expect_exit_status=0, **kwargs): """Execute command inside a remote or local shell diff --git a/tobiko/shell/sh/_local.py b/tobiko/shell/sh/_local.py index f0f0ab0de..46aa38a1f 100644 --- a/tobiko/shell/sh/_local.py +++ b/tobiko/shell/sh/_local.py @@ -30,7 +30,7 @@ LOG = log.getLogger(__name__) def local_execute(command, environment=None, timeout=None, shell=None, - stdin=True, stdout=True, stderr=True, expect_exit_status=0, + stdin=None, stdout=None, stderr=None, expect_exit_status=0, **kwargs): """Execute command on local host using local shell""" process = local_process(command=command, diff --git a/tobiko/shell/sh/_process.py b/tobiko/shell/sh/_process.py index 8b71ccb98..f83d4da12 100644 --- a/tobiko/shell/sh/_process.py +++ b/tobiko/shell/sh/_process.py @@ -330,8 +330,8 @@ class ShellProcessFixture(tobiko.SharedFixture): LOG.debug("Command '%s' succeeded (exit_status=%d):\n" "stdin:\n%s\n" - "stderr:\n%s\n" - "stdout:\n%s", + "stdout:\n%s\n" + "stderr:\n%s", self.command, exit_status, self.stdin, self.stdout, self.stderr) @@ -370,7 +370,10 @@ class ShellProcessTimeout(object): def str_from_stream(stream): - return stream and str(stream) or None + if stream is not None: + return str(stream) + else: + return None def default_shell_command(): diff --git a/tobiko/shell/sh/_ssh.py b/tobiko/shell/sh/_ssh.py index 4928347af..7b5094133 100644 --- a/tobiko/shell/sh/_ssh.py +++ b/tobiko/shell/sh/_ssh.py @@ -29,7 +29,7 @@ LOG = log.getLogger(__name__) def ssh_execute(ssh_client, command, environment=None, timeout=None, - stdin=True, stdout=True, stderr=True, shell=None, + stdin=None, stdout=None, stderr=None, shell=None, expect_exit_status=0, **kwargs): """Execute command on local host using local shell""" process = ssh_process(command=command,