Skip to content

fix: make postProvision.sh venv cleanup non-fatal — closes #426#427

Merged
placerda merged 1 commit intoAzure:developfrom
sihbher:fix/issue-426-venv-cleanup-failure
Mar 16, 2026
Merged

fix: make postProvision.sh venv cleanup non-fatal — closes #426#427
placerda merged 1 commit intoAzure:developfrom
sihbher:fix/issue-426-venv-cleanup-failure

Conversation

@sihbher
Copy link
Contributor

@sihbher sihbher commented Mar 9, 2026

The cleanup block at the end of postProvision.sh fails under set -euo pipefail when rm -rf cannot remove the Python 3.14 venv directory on macOS (file handles still held by recently completed python -m invocations).

  • Add trap EXIT handler to ensure cleanup runs even on early script exits
  • Replace rm -rf with python3 shutil.rmtree (handles locked files gracefully)
  • Skip deactivate at script end (no shell state to restore)

Brings postProvision.sh to parity with the care already applied in postProvision.ps1, which has its cleanup commented out for the same reason.

Purpose

Contributing guidelines

Please see Contributing Guidelines before creating your Pull Request.

Type of change

  • Bugfix
  • Feature
  • Code style update (formatting, local variables)
  • Refactoring (no functional changes, no api changes)
  • Documentation content changes
  • Other... Please describe:

Related Backlog Item or Issue

If applicable, provide a link to the relevant backlog item or issue.

Is this change disruptive or does it break existing applications?

If deploying this change could impact existing applications, please specify.

  • Yes
  • No

Cross-Repository Dependencies

If this change depends on pull requests in other repositories within the solution, provide the links below.

Does this require changes to project documentation?

If the changes add new functionality, update the documentation accordingly.

  • Yes
  • No

Documentation Link

If this change adds a new functionality, provide a link to its documentation.

Code quality checklist

  • I verified the changes locally to ensure they work as expected
  • I have tested the new functionality and ensured existing features still work
  • I have reviewed the code for readability, maintainability, and adherence to project conventions
  • I have added at least two reviewers to the Pull Request

The cleanup block at the end of postProvision.sh fails under set -euo pipefail
when rm -rf cannot remove the Python 3.14 venv directory on macOS (file handles
still held by recently completed python -m invocations).

- Add trap EXIT handler to ensure cleanup runs even on early script exits
- Replace rm -rf with python3 shutil.rmtree (handles locked files gracefully)
- Skip deactivate at script end (no shell state to restore)

Brings postProvision.sh to parity with the care already applied in
postProvision.ps1, which has its cleanup commented out for the same reason.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@placerda placerda merged commit e094838 into Azure:develop Mar 16, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants