mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-29 21:12:07 -06:00
tests/functional: replace 'run_cmd' with subprocess helpers
The 'run_cmd' helper is re-implementing a convenient helper that already exists in the form of the 'run' and 'check_call' methods provided by 'subprocess'. Reviewed-by: Thomas Huth <thuth@redhat.com> Signed-off-by: Daniel P. Berrangé <berrange@redhat.com> Message-ID: <20241217155953.3950506-29-berrange@redhat.com> Signed-off-by: Thomas Huth <thuth@redhat.com>
This commit is contained in:
parent
3bb4c8b613
commit
37e9b19c34
6 changed files with 41 additions and 30 deletions
|
@ -14,7 +14,6 @@ from urllib.parse import urlparse
|
|||
import zipfile
|
||||
|
||||
from .asset import Asset
|
||||
from .cmd import run_cmd
|
||||
|
||||
|
||||
def tar_extract(archive, dest_dir, member=None):
|
||||
|
@ -52,9 +51,11 @@ def deb_extract(archive, dest_dir, member=None):
|
|||
cwd = os.getcwd()
|
||||
os.chdir(dest_dir)
|
||||
try:
|
||||
(stdout, stderr, ret) = run_cmd(['ar', 't', archive])
|
||||
file_path = stdout.split()[2]
|
||||
run_cmd(['ar', 'x', archive, file_path])
|
||||
proc = run(['ar', 't', archive],
|
||||
check=True, capture_output=True, encoding='utf8')
|
||||
file_path = proc.stdout.split()[2]
|
||||
check_call(['ar', 'x', archive, file_path],
|
||||
stdout=DEVNULL, stderr=DEVNULL)
|
||||
tar_extract(file_path, dest_dir, member)
|
||||
finally:
|
||||
os.chdir(cwd)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue