Skip to content

Commit

Permalink
fix: ignore errors in rmtree (3.8+ should be fine on Windows now)
Browse files Browse the repository at this point in the history
  • Loading branch information
henryiii committed Nov 5, 2024
1 parent 122835a commit 275fe8f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion nox/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ def run_script_mode(envdir: Path, reuse: bool, dependencies: list[str]) -> NoRet
if sys.platform.startswith("win"):
raise SystemExit(
subprocess.run(
["nox", sys.argv[1:]],
["nox", *sys.argv[1:]],
env=venv.env,
stdout=None,
stderr=None,
Expand Down
7 changes: 3 additions & 4 deletions nox/virtualenv.py
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ def _clean_location(self) -> bool:
if self.reuse_existing and is_conda:
return False
if not is_conda:
shutil.rmtree(self.location)
shutil.rmtree(self.location, ignore_errors=True)
else:
cmd = [
self.conda_cmd,
Expand All @@ -318,8 +318,7 @@ def _clean_location(self) -> bool:
]
nox.command.run(cmd, silent=True, log=False)
# Make sure that location is clean
with contextlib.suppress(FileNotFoundError):
shutil.rmtree(self.location)
shutil.rmtree(self.location, ignore_errors=True)

return True

Expand Down Expand Up @@ -446,7 +445,7 @@ def _clean_location(self) -> bool:
and self._check_reused_environment_interpreter()
):
return False
shutil.rmtree(self.location)
shutil.rmtree(self.location, ignore_errors=True)
return True

def _read_pyvenv_cfg(self) -> dict[str, str] | None:
Expand Down

0 comments on commit 275fe8f

Please sign in to comment.