run_command function for tests adjusted

This commit is contained in:
Nicolas 2025-10-14 23:02:30 +02:00
parent b5e6130eb8
commit f09ca81a61
1 changed files with 4 additions and 6 deletions

View File

@ -5,12 +5,10 @@ import struct
from copapy import binwrite from copapy import binwrite
def run_command(command: list[str], encoding: str = 'utf8') -> str: def run_command(command: list[str]) -> str:
process = subprocess.Popen(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE) result = subprocess.run(command, stdout=subprocess.PIPE, stderr=subprocess.PIPE, encoding='utf8', check=False)
output, error = process.communicate() assert result.returncode == 0, f"\n -Error occurred: {result.stderr}\n -Output: {result.stdout}"
return result.stdout
assert not error, f"\n -Error occurred: {error.decode(encoding)}\n -Output: {output.decode(encoding)}"
return output.decode(encoding)
def test_example(): def test_example():