Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Calling symlinkOrCopySync on a path with existing file 💥 #43

Open
twokul opened this issue Dec 8, 2016 · 2 comments
Open

Calling symlinkOrCopySync on a path with existing file 💥 #43

twokul opened this issue Dec 8, 2016 · 2 comments

Comments

@twokul
Copy link

twokul commented Dec 8, 2016

https://embercommunity.slack.com/archives/dev-ember-cli/p1481157690003118

input node includes files foo.js and foo.hbs

  • using a broccoli-filter that takes .hbs -> .js
  • 💥

This is because we unconditionally call symlinkOrCopySync from srcPath to destPath. But since we copy forward all files, the output path already includes foo.js when we attempt to symlink the output of transpiling foo.hbs. I think step one would be to setup a failing test in broccoli-filter with ^ as a minimal reproduction.

The solution likely either includes:

  • tracking when we have already written to a given dest path and just call fs.unlinkSync(destPath) before calling symlinkOrCopy.sync
  • use try/catch and auto-retry upon EEXIST error after unlinking

cc @rwjblue

@twokul twokul mentioned this issue Dec 9, 2016
@joliss
Copy link
Member

joliss commented Feb 14, 2017

It seems OK to me to throw an error here. It's not clear to me that we should simply overwrite foo.js.

@rwjblue
Copy link
Member

rwjblue commented Feb 14, 2017

If we do want to error, we should emit an actually useful error message (and potentially consider making an { overwrite: true } style option).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants