Closed schomatis closed 6 years ago
@schomatis I created a similar patch to this https://github.com/whyrusleeping/gx/pull/163 It moves the check up so it only tries to remove when proven to exist and also removes an uneeded dependency.
Sorry for the overlap, I came across this independently when I got frustrated with an ambiguous "Access is denied" error. I didn't see this pull request when I started.
I can instigating failure by doing this inside of the go-ipfs
repo
gx install --local
git clean -fdx
gx install --local
git clean -fdx was not removing any packages with tests in them which caused the problem when trying to move the temporary to the target.
@schomatis sorry I didnt see this one either. I'm merging @djdv's PR as both of these fixes work, but he points out that go's os package now properly does the rename, we no longer need the gorename package.
thank you for the PR!
@djdv No problem, I'm closing this PR as I like your solution more, it employs the standard library and handles the existence of the destination in a logically coherent place: next to the original check of FindPackageInDir
, even if the Shell().Get()
fails (for other reasons) it makes sense that the destination should be removed early in the function.
Oh, @whyrusleeping already took care of it :)
If the
package.json
file is missing from an installed package (not very likely) fetch will fail while trying to rename to an existing directory.Should a test be added?