deno_std
deno_std copied to clipboard
fs/mod.ts ensureSymlinkSync throws error with code EEXIST
Describe the bug
Steps to Reproduce
- Create a directory of
./dir_src. - Create and run the script below
import { ensureSymlinkSync } from "https://deno.land/[email protected]/fs/mod.ts";
ensureSymlinkSync('./dir_src', './dir_dest');
ensureSymlinkSync('./dir_src', './dir_dest');
Expected behavior
It doesn't throw an error.
Environment
- OS: Debian Bullseye, inside docker
- deno version: 1.21.0
- std version: 0.154.0
** Example Error **
error: Uncaught (in promise) AlreadyExists: File exists (os error 17), symlink '/sbbs-data/backup' -> '/backup'
Deno.symlinkSync(src, dest, options);
^
at Object.opSync (deno:core/01_core.js:172:12)
at Object.symlinkSync (deno:runtime/js/30_fs.js:355:10)
at ensureSymlinkSync (https://deno.land/[email protected]/fs/ensure_symlink.ts:48:8)
at ensureSymlinkSync (file:///sbbs/scripts/init.ts:12:5)
at checkAll (file:///sbbs/scripts/init.ts:128:5)
Not sure if it matters, but the src directory is under a Docker volume mount, and the destination is inside the container... not sure if that makes a difference... should probably trap and swallow that error code anyway.