Skip to content

Commit

Permalink
Fixing error handling for lock files
Browse files Browse the repository at this point in the history
  • Loading branch information
marcleblanc2 committed Mar 21, 2024
1 parent f9f54d6 commit ab392a0
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions repo-converter/build/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -1151,8 +1151,7 @@ def subprocess_run(args, password=None, echo_password=None, quiet=False):
if check_lock_files(args, process_dict):

# Change the log_level to debug so the failed process doesn't log an error in print_process_status()
# log_level = "debug"
pass
log_level = "debug"

print_process_status(process_dict, status_message, truncated_subprocess_output_to_log, log_level)

Expand Down Expand Up @@ -1205,8 +1204,13 @@ def check_lock_files(args, process_dict):

lock_file_content = ""

with open(lock_file_path, "r") as lock_file_object:
lock_file_content = lock_file_object.read()
try:

with open(lock_file_path, "r") as lock_file_object:
lock_file_content = lock_file_object.read()

except UnicodeDecodeError as exception:
lock_file_content = exception

log(f"pid {pid} failed; {process} failed to start due to finding a lock file in the repo at {lock_file_path}, but no other process is running with {process_command}; deleting the lock file so it'll try again on the next run; lock file content: {lock_file_content}", "warning")

Expand Down

0 comments on commit ab392a0

Please sign in to comment.