Commit 17eb498
committed
Fix Windows file locking error when rendering with --output-dir
When --output-dir is used without a project file, Quarto creates a
synthetic project context with a temporary .quarto directory to manage
the render. This fix ensures file handles are closed before attempting
to remove the directory, preventing Windows "os error 32" (file in use
by another process).
The synthetic project pattern:
- Triggered when: quarto render file.qmd --output-dir output/ (no _quarto.yml)
- Creates temporary .quarto directory in current directory
- Uses full renderProject() path (not singleFileProjectContext())
- forceClean flag in RenderOptions signals cleanup needed
- After render: close handles (context.cleanup()) then remove directory
Improved comments to explain the synthetic project pattern, the dual
purpose of the forceClean flag, and critical ordering requirements to
avoid file locking issues on Windows.
Fixes #136251 parent 15c5adf commit 17eb498
3 files changed
+18
-8
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
61 | 61 | | |
62 | 62 | | |
63 | 63 | | |
| 64 | + | |
64 | 65 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
886 | 886 | | |
887 | 887 | | |
888 | 888 | | |
889 | | - | |
890 | | - | |
891 | | - | |
892 | | - | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
| 892 | + | |
| 893 | + | |
893 | 894 | | |
894 | | - | |
| 895 | + | |
| 896 | + | |
| 897 | + | |
895 | 898 | | |
| 899 | + | |
| 900 | + | |
| 901 | + | |
| 902 | + | |
896 | 903 | | |
897 | 904 | | |
898 | 905 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
48 | 48 | | |
49 | 49 | | |
50 | 50 | | |
51 | | - | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
52 | 54 | | |
53 | | - | |
54 | 55 | | |
55 | 56 | | |
56 | | - | |
| 57 | + | |
| 58 | + | |
57 | 59 | | |
58 | 60 | | |
59 | 61 | | |
| |||
0 commit comments