Skip to content

shelljs cp handling symlinks badly #69

@ghost

Description

Making a build script for a project. using shelljs/make in coffeescript.
when I try to call this function:
cp '-fR', build_dir+'/*', dest_dir

node kicks back this ugly chunk:

shell.js: internal error
Error: EEXIST, file already exists '/[dest_dir]/node_modules/.bin/express'
  at Object.fs.symlinkSync (fs.js:730:18)
  at cpdirSyncRecursive (/[redac]/node_modules/shelljs/shell.js:1575:10)
  at cpdirSyncRecursive (/redac]/node_modules/shelljs/shell.js:1572:7)
  at /redac]/node_modules/shelljs/shell.js:325:9
  at Array.forEach (native)
  at _cp (/redac]/node_modules/shelljs/shell.js:302:11)
  at /redac]/node_modules/shelljs/shell.js:1491:23
  at Function.target.install (/redac]/grind:65:3, <js>:63:5)
  at Object.target.(anonymous function) [as install] (/redac]/node_modules/shelljs/make.js:28:26)
  at Function.target.fast (/redac]/grind:25:3, <js>:19:12)
  at Object.target.(anonymous function) [as fast] (/redac]/node_modules/shelljs/make.js:28:26)
  at /redac]/node_modules/shelljs/make.js:38:20
  at Array.forEach (native)
  at [object Object]._onTimeout (/redac]/node_modules/shelljs/make.js:36:10)
  at Timer.listOnTimeout [as ontimeout] (timers.js:110:15)

The symlink in question from the source directory is:
../express/bin/express
Also, I'm overwriting whatever is in the destination in this instance. That file and the express file exists, I'm sure.

On the other hand, exec "cp -rf #{build_dir}/* #{dest_dir}" works perfectly as intended.

I'll take a crack at looking at the source later and seeing what it might be, just wanted to log it while I'm still thinking about it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    fixBug/defect, or a fix for such a problem

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions