fix(foreign): keep Windows temp paths non-verbatim
ci/woodpecker/push/woodpecker Pipeline was successful
Linux strict security lane (G-C) / strict isolation escape matrix (push) Canceled after 0s
CI / fmt + clippy + test (Linux x86_64) (push) Canceled after 0s
CI / schema instance validation + consumers (push) Canceled after 0s
CI / runtime contract (macos-latest) (push) Canceled after 0s
CI / runtime contract (windows-latest) (push) Canceled after 0s
CI / release evidence manifest (push) Canceled after 0s
CI / release candidate artifact (macos-latest) (push) Canceled after 0s
CI / release candidate artifact (ubuntu-latest) (push) Canceled after 0s

fs::canonicalize on Windows returns a \\?\C:\... path. Node's module loader
lstats the working/script path and rejects the verbatim form, so all Node
foreign-kernel tests failed on windows-latest. Use the native temp directory on
Windows and retain canonicalization on Unix for symlink safety; widen the CI
annotator so any remaining native failure shows a full assertion block.
This commit is contained in:
cflmy committed 2026-11-21 18:49:05 +08:00
1 parent 4265231a14
commit a24161c934
2 files changed
+13 -2

No files matched your search

+8
View File
@@ -1058,6 +1058,14 @@ struct TempArtifacts {
impl TempArtifacts {
fn create(extension: &str) -> Result<Self, ForeignError> {
// `fs::canonicalize` on Windows returns a verbatim `\\?\C:\...`
// path. Node's module loader uses the working directory/script path
// with `lstat` and rejects that form (`node:fs` ENOENT/UNKNOWN), even
// though Rust can open it. Use the native temp path on Windows and
// keep canonicalization for Unix symlink safety.
#[cfg(windows)]
let base = std::env::temp_dir();
#[cfg(not(windows))]
let base = fs::canonicalize(std::env::temp_dir()).unwrap_or_else(|_| std::env::temp_dir());
let mut last_error: Option<io::Error> = None;
for _ in 0..16 {