Skip to content

Commit

Permalink
! F catchall try/except when downloading
Browse files Browse the repository at this point in the history
Co-Authored-By: 4dsherwood <4dsherwood@users.noreply.github.com>
Co-Authored-By: Jay Bazuzi <jay@bazuzi.com>
Co-Authored-By: Nitsan Avni <nitsanav@gmail.com>
  • Loading branch information
4 people committed Feb 2, 2025
1 parent 6175d45 commit f3e7ad4
Showing 1 changed file with 15 additions and 12 deletions.
27 changes: 15 additions & 12 deletions approvaltests/internals/logs/log_commons.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,17 +10,20 @@
class LogCommons:
@staticmethod
def download_script_if_needed(script_basename: str) -> None:
suffix = ".bat" if is_windows_os() else ".sh"
script_name_with_suffix = f"{script_basename}{suffix}"
script_path = Path(APPROVAL_TESTS_TEMP_DIRECTORY) / script_name_with_suffix
if script_path.exists():
return
try:
suffix = ".bat" if is_windows_os() else ".sh"
script_name_with_suffix = f"{script_basename}{suffix}"
script_path = Path(APPROVAL_TESTS_TEMP_DIRECTORY) / script_name_with_suffix
if script_path.exists():
return

response = requests.get(
f"https://raw.githubusercontent.com/approvals/ApprovalTests.Java/refs/heads/master/resources/{script_name_with_suffix}"
)
if response.ok:
script_path.write_text(response.text)
response = requests.get(
f"https://raw.githubusercontent.com/approvals/ApprovalTests.Java/refs/heads/master/resources/{script_name_with_suffix}"
)
if response.ok:
script_path.write_text(response.text)

make_executable = 0o755
script_path.chmod(make_executable)
make_executable = 0o755
script_path.chmod(make_executable)
except:
pass

0 comments on commit f3e7ad4

Please sign in to comment.