Skip to content

Commit 1e5f5fd

Browse files
Copilotmnriem
andauthored
Fix shutil.move with existing step_dir: remove before move to avoid subdirectory nesting
Agent-Logs-Url: https://github.com/github/spec-kit/sessions/3e18fef0-e2e6-4b3e-9e8d-9adb1e5e464e Co-authored-by: mnriem <15701806+mnriem@users.noreply.github.com>
1 parent 3e30520 commit 1e5f5fd

1 file changed

Lines changed: 5 additions & 1 deletion

File tree

src/specify_cli/__init__.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5515,8 +5515,12 @@ def _safe_fetch(url: str) -> bytes:
55155515
(tmp_path / "__init__.py").write_bytes(init_py_content)
55165516

55175517
steps_base_dir.mkdir(parents=True, exist_ok=True)
5518+
# Remove any pre-existing step_dir before the move; shutil.move would
5519+
# otherwise place tmp_path as a *subdirectory* of an existing target.
5520+
if step_dir.exists():
5521+
shutil.rmtree(step_dir)
55185522
shutil.move(str(tmp_path), str(step_dir))
5519-
_install_success = True
5523+
_install_success = True # set immediately after move succeeds
55205524
finally:
55215525
if not _install_success:
55225526
shutil.rmtree(tmp_path, ignore_errors=True)

0 commit comments

Comments
 (0)