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

--path option writing to wrong destination #157

Closed
dunkmann00 opened this issue Jun 21, 2021 · 2 comments · Fixed by #158
Closed

--path option writing to wrong destination #157

dunkmann00 opened this issue Jun 21, 2021 · 2 comments · Fixed by #158
Labels
bug Something isn't working

Comments

@dunkmann00
Copy link
Contributor

When I tried to set the --path option when installing a prebuild, it would append the path value twice.

For example:
--path path/to/directory/
unpack resolved to .../path/to/directory/path/to/directory/

I think this is because in bin.js a new process is spawned in the path directory when one is present:

if (rc.path) process.chdir(rc.path)

And then in download.js the path is appended onto the current directory, which it shouldn't because we are already in the directory of the path:

resolved = path.resolve(opts.path || '.', binaryName)

So I think in dowload we wouldn't want to check for path again, just always use '.'?

This just pertains to relative paths.

@dunkmann00
Copy link
Contributor Author

It looks like the opts.path option is also used here:

var extract = tfs.extract(opts.path, options).on('entry', updateName)

which is what actually controls where the prebuilt binary is saved.

@vweevers
Copy link
Member

If we make rc.path an absolute path - i.e. rc.path = path.resolve(rc.path) - then it wouldn't matter that rc.path is reused multiple times. Might be redundant, but we'd avoid having to refactor.

@vweevers vweevers added the bug Something isn't working label Jun 22, 2021
vweevers pushed a commit that referenced this issue Aug 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants