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

gentoo-build: Keep log file on error #88

Merged
merged 1 commit into from
Mar 10, 2022
Merged
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
12 changes: 7 additions & 5 deletions binary_gentoo/internal/cli/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -374,9 +374,11 @@ def build(config):
if config.interactive:
docker_run_args = ['-it'] + docker_run_args

delete_log = False
try:
announce_and_call(['docker', 'run'] + docker_run_args,
stdout=log_writer_process.stdin)
delete_log = True

if config.tag_docker_image is not None:
announce_and_call(
Expand All @@ -385,11 +387,11 @@ def build(config):
log_writer_process.stdin.close()
log_writer_process.wait()

with suppress(FileNotFoundError):
os.remove(host_log_filename)
with suppress(OSError):
os.rmdir(host_logdir__category__package)
os.rmdir(host_logdir__category)
if delete_log:
with suppress(OSError):
os.remove(host_log_filename)
os.rmdir(host_logdir__category__package)
os.rmdir(host_logdir__category)

if config.tag_docker_image is not None:
announce_and_call(['docker', 'rm', container_name])
Expand Down