1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-11-30 16:40:57 -05:00

fix(compile): do not error embedding same symlink via multiple methods (#27015)

Closes https://github.com/denoland/deno/issues/27012
This commit is contained in:
David Sherret 2024-11-25 17:08:06 -05:00 committed by GitHub
parent 7456255cd1
commit 02b480b171
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 32 additions and 2 deletions

View file

@ -329,7 +329,7 @@ impl VfsBuilder {
let dir = self.add_dir(path.parent().unwrap())?;
let name = path.file_name().unwrap().to_string_lossy();
match dir.entries.binary_search_by(|e| e.name().cmp(&name)) {
Ok(_) => unreachable!(),
Ok(_) => Ok(()), // previously inserted
Err(insert_index) => {
dir.entries.insert(
insert_index,
@ -341,9 +341,9 @@ impl VfsBuilder {
.collect::<Vec<_>>(),
}),
);
Ok(())
}
}
Ok(())
}
pub fn into_dir_and_files(self) -> (VirtualDirectory, Vec<Vec<u8>>) {

View file

@ -0,0 +1,27 @@
{
"tempDir": true,
"steps": [{
"args": "run -A setup.js",
"output": "[WILDCARD]"
}, {
"if": "unix",
"args": "compile --allow-read=data --include . --output main link.js",
"output": "[WILDCARD]"
}, {
"if": "unix",
"commandName": "./main",
"args": [],
"output": "1\n",
"exitCode": 0
}, {
"if": "windows",
"args": "compile --allow-read=data --include . --output main.exe link.js",
"output": "[WILDCARD]"
}, {
"if": "windows",
"commandName": "./main.exe",
"args": [],
"output": "1\n",
"exitCode": 0
}]
}

View file

@ -0,0 +1,3 @@
Deno.mkdirSync("data");
Deno.writeTextFileSync("index.js", "console.log(1);");
Deno.symlinkSync("index.js", "link.js");