Skip to content
Snippets Groups Projects
Commit a3fc1996 authored by Piotr Maślanka's avatar Piotr Maślanka
Browse files

2.7.16

parent 64200659
No related branches found
Tags v2.7.16
No related merge requests found
__version__ = '2.7.16_a4' __version__ = '2.7.16'
...@@ -30,28 +30,23 @@ def call_and_return_stdout(args: tp.Union[str, tp.List[str]], ...@@ -30,28 +30,23 @@ def call_and_return_stdout(args: tp.Union[str, tp.List[str]],
within this time, it will be sent a SIGKILL within this time, it will be sent a SIGKILL
:param expected_return_code: an expected return code of this process. 0 is the default. If process :param expected_return_code: an expected return code of this process. 0 is the default. If process
returns anything else, ProcessFailed will be raise returns anything else, ProcessFailed will be raise
:param ProcessFailed: process' result code was different from the requested :raises ProcessFailed: process' result code was different from the requested
""" """
if isinstance(args, str): if isinstance(args, str):
args = args.split(' ') args = args.split(' ')
logger.warning('Modifying kwargs')
kwargs['stdout'] = subprocess.PIPE kwargs['stdout'] = subprocess.PIPE
stdout_list = [] stdout_list = []
logger.warning('Starting popen')
proc = subprocess.Popen(args, **kwargs) proc = subprocess.Popen(args, **kwargs)
reader_thread = threading.Thread(target=read_nowait, args=(proc, stdout_list), daemon=True) reader_thread = threading.Thread(target=read_nowait, args=(proc, stdout_list), daemon=True)
logger.warning('Starting rt')
reader_thread.start() reader_thread.start()
logger.warning('Waiting for termination')
try: try:
proc.wait(timeout=timeout) proc.wait(timeout=timeout)
except subprocess.TimeoutExpired: except subprocess.TimeoutExpired:
proc.kill() proc.kill()
proc.wait() proc.wait()
logger.warning('Terminated')
if proc.returncode != expected_return_code: if proc.returncode != expected_return_code:
raise ProcessFailed(proc.returncode) raise ProcessFailed(proc.returncode)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment