Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(subprocess): wait for process stop in case of None returncode #80

Merged
merged 4 commits into from
Mar 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

## x.y.z

## 2.2.6

FIXED:
- subprocess : None value can be returned as returncode. Need to wait for process stop in this case

## 2.2.5

CHANGED:
Expand Down
7 changes: 5 additions & 2 deletions r2gg/_subprocess_execution.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,12 @@ def subprocess_execution(args, logger, outfile = None):
process_output, _ = process.communicate()
logger.info(process_output.decode("utf-8"))

returncode = process.returncode
# Wait for process stop
while process.returncode is None:
process.wait()

if process.returncode != 0:
error_msg = f"Invalid returncode {returncode} for subprocess '{subprocess_arg}'"
error_msg = f"Invalid returncode {process.returncode} for subprocess '{subprocess_arg}'"
logger.error(error_msg)
raise RuntimeError(error_msg)

Expand Down
Loading