test-framework: Fix Python subprocess shell

Signed-off-by: Rafal Stefanowski <rafal.stefanowski@huawei.com>
This commit is contained in:
Rafal Stefanowski 2024-04-04 11:58:34 +02:00 committed by Kamil Gierszewski
parent 5e9bba66c2
commit 5051ef1f1a
No known key found for this signature in database
2 changed files with 6 additions and 0 deletions

View File

@ -1,5 +1,6 @@
#
# Copyright(c) 2019-2021 Intel Corporation
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
# SPDX-License-Identifier: BSD-3-Clause
#
@ -15,6 +16,7 @@ class LocalExecutor(BaseExecutor):
completed_process = subprocess.run(
command,
shell=True,
executable="/bin/bash",
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
timeout=timeout.total_seconds())
@ -40,6 +42,7 @@ class LocalExecutor(BaseExecutor):
completed_process = subprocess.run(
f'rsync -r {src} {dst} {" ".join(options)}',
shell=True,
executable="/bin/bash",
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
timeout=timeout.total_seconds())

View File

@ -1,5 +1,6 @@
#
# Copyright(c) 2019-2021 Intel Corporation
# Copyright(c) 2024 Huawei Technologies Co., Ltd.
# SPDX-License-Identifier: BSD-3-Clause
#
import os
@ -118,6 +119,7 @@ class SshExecutor(BaseExecutor):
f'-o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" '
+ src_to_dst + f'{" ".join(options)}',
shell=True,
executable="/bin/bash",
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
timeout=timeout.total_seconds())
@ -210,6 +212,7 @@ class SshExecutor(BaseExecutor):
completed_process = subprocess.run(
f"ssh{identity_str} -p {port}{param} {user_str}{hostname} {command}",
shell=True,
executable="/bin/bash",
stdout=subprocess.PIPE,
stderr=subprocess.PIPE,
timeout=30)