Skip to content

Commit 39ba722

Browse files
authored
Merge pull request #11095 from quarto-dev/bugfix/10622
attempt to move by cp+rm when mv fails
2 parents 13f1fe8 + a5b1747 commit 39ba722

File tree

2 files changed

+19
-9
lines changed

2 files changed

+19
-9
lines changed

news/changelog-1.6.md

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,6 @@ All changes included in 1.6:
100100
- Upgrade `mermaidjs` to 11.2.0.
101101
- Upgrade Pandoc to 3.4.
102102
- Upgrade `deno` to 1.46.3.
103-
- ([#11068](https://github.com/quarto-dev/quarto-cli/issues/11068)): use standard location when writing to standard output to avoid breakage under `self-contained: true`.
104103
- ([#10162](https://github.com/quarto-dev/quarto-cli/issues/10162)): Use Edge on `macOS` as a Chromium browser when available.
105104
- ([#10235](https://github.com/quarto-dev/quarto-cli/issues/10235)): Configure the CI schedule trigger to activate exclusively for the upstream repository.
106105
- ([#10295](https://github.com/quarto-dev/quarto-cli/issues/10235)): Fix regression to return error status to shell when `CommandError` is thrown.
@@ -111,6 +110,8 @@ All changes included in 1.6:
111110
- ([#10581](https://github.com/quarto-dev/quarto-cli/issues/10581)): Add `.landscape` div processing to `typst`, `docx` and `pdf` formats to support pages in landscape orientation.
112111
- ([#10591](https://github.com/quarto-dev/quarto-cli/issues/10591)): Make fenced div syntax slightly more robust by removing spaces around the `=` sign ahead of Pandoc's reader.
113112
- ([#10608](https://github.com/quarto-dev/quarto-cli/issues/10608)): Don't overwrite the built-in CSS function `contrast` in Quarto's SCSS.
113+
- ([#10622](https://github.com/quarto-dev/quarto-cli/issues/10622)): Use copy+remove instead of move when needed to support temporary directories in different filesystems.
114114
- ([#10821](https://github.com/quarto-dev/quarto-cli/issues/10821)): Be more conservative in stripping `echo: fenced` from fenced output.
115115
- ([#10890](https://github.com/quarto-dev/quarto-cli/issues/10890)): Don't use ports that Firefox considers unsafe.
116116
- ([#10936](https://github.com/quarto-dev/quarto-cli/issues/10936)): Use `\\` in `meta` shortcode to escape the following character, allowing keys with `.` in them.
117+
- ([#11068](https://github.com/quarto-dev/quarto-cli/issues/11068)): use standard location when writing to standard output to avoid breakage under `self-contained: true`.

src/command/render/project.ts

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -477,15 +477,24 @@ export async function renderProject(
477477
// remove directories, we should instead make a function that
478478
// does that explicitly, rather than as a side effect of a missing
479479
// src Dir
480-
if (existsSync(srcDir)) {
481-
if (existsSync(targetDir)) {
482-
Deno.removeSync(targetDir, { recursive: true });
483-
}
484-
ensureDirSync(dirname(targetDir));
485-
if (copy) {
486-
copyTo(srcDir, targetDir);
487-
} else {
480+
if (!existsSync(srcDir)) {
481+
return;
482+
}
483+
if (existsSync(targetDir)) {
484+
Deno.removeSync(targetDir, { recursive: true });
485+
}
486+
ensureDirSync(dirname(targetDir));
487+
if (copy) {
488+
copyTo(srcDir, targetDir);
489+
} else {
490+
try {
488491
Deno.renameSync(srcDir, targetDir);
492+
} catch (_e) {
493+
// if renaming failed, it could have happened
494+
// because src and target are in different file systems.
495+
// In that case, try to recursively copy from src
496+
copyTo(srcDir, targetDir);
497+
Deno.removeSync(srcDir, { recursive: true });
489498
}
490499
}
491500
};

0 commit comments

Comments
 (0)