Skip to content

Commit 9f22ab9

Browse files
committed
fix(cli): refine OSError handling and finalize atomic write logic
1 parent 44d05ac commit 9f22ab9

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

src/specify_cli/__init__.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -720,13 +720,13 @@ def merge_json_files(existing_path: Path, new_content: Any, verbose: bool = Fals
720720
# Handle comments (JSONC) natively with json5
721721
# Note: json5 handles BOM automatically
722722
existing_content = json5.load(f)
723-
except (FileNotFoundError, OSError):
723+
except FileNotFoundError:
724724
# Handle race condition where file is deleted after exists() check
725725
exists = False
726726
except Exception as e:
727727
if verbose:
728-
console.print(f"[yellow]Warning: Could not parse existing JSON in {existing_path.name} ({e}).[/yellow]")
729-
# Skip merge to preserve existing file if unparseable
728+
console.print(f"[yellow]Warning: Could not read or parse existing JSON in {existing_path.name} ({e}).[/yellow]")
729+
# Skip merge to preserve existing file if unparseable or inaccessible (e.g. PermissionError)
730730
return None
731731

732732
# Validate template content

0 commit comments

Comments
 (0)