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

fix(addons-v5): Use os.tmpdir() rather than /tmp for cross-platform support - fixes #1506 #1518

Merged
merged 2 commits into from
May 15, 2020

Conversation

KevinBrolly
Copy link
Contributor

Using addons:open with sudo on windows shows ENOENT: no such file or directory, open 'C:\tmp\heroku-sso.html'. /tmp is not available by default in windows. This change uses os.tmpdir() rather than /tmp.

@KevinBrolly KevinBrolly requested a review from a team as a code owner May 14, 2020 19:34

function open (url) {
cli.log(`Opening ${cli.color.cyan(url)}...`)
return cli.open(url)
}

const ssoPath = '/tmp/heroku-sso.html'
const ssoPath = os.tmpdir() + '/heroku-sso.html'
Copy link
Contributor

@fivetanley fivetanley May 15, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you add an import for path = require('path') at the top of the page and use path.join(os.tmpdir(), 'heroku-sso.html') instead? this will help keep the path separators (\ on windows, / on mac/linux) normalized between platforms.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice! Made this change, thanks!

@KevinBrolly KevinBrolly requested a review from fivetanley May 15, 2020 15:37
Copy link
Contributor

@chadian chadian left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix!

@chadian chadian merged commit 23f45d9 into master May 15, 2020
@chadian chadian deleted the sudo-tmpdir branch May 15, 2020 16:35
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 this pull request may close these issues.

3 participants