Skip to content

Add executable check for local xdg-open - #140

Merged
sindresorhus merged 2 commits into
sindresorhus:masterfrom
deansheather:xdg-open-check
Jun 29, 2019
Merged

sindresorhus merged 2 commits into
sindresorhus:masterfrom
deansheather:xdg-open-check

Conversation

@deansheather

Copy link
Copy Markdown
Contributor

Uses the executable package to ensure that the local/included xdg-open is executable. If it's not executable (or there was some other error checking if it was executable, for example ENOENT), it will fall back to system xdg-open instead.

This allows for use within environments where open thought it could run the bundled xdg-open but it actually can't, such as in binaries produced by a node.js binary compiler like nbin.

Inspired by #138 (comment).

@sindresorhus

Copy link
Copy Markdown
Owner

I would prefer using fs.access('file', fs.constants.X_OK)

@deansheather

Copy link
Copy Markdown
Contributor Author

@sindresorhus Updated the PR, could you review?

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.

2 participants

⌂ Proxy