Skip to content

refactor: create common.execPath#636

Merged
freitagbr merged 1 commit intomasterfrom
refactor-execpath
Jan 8, 2017
Merged

refactor: create common.execPath#636
freitagbr merged 1 commit intomasterfrom
refactor-execpath

Conversation

@nfischer
Copy link
Copy Markdown
Member

Switch to using common.execPath instead of process.execPath directly and warn
electron users if we were unable to find the correct path to NodeJS.

This should be safe to merge into master because exec didn't work before anyway.

Fixes #633

@nfischer nfischer added bash compat Compatibility issues with bash or POSIX behavior blocked labels Dec 21, 2016
@nfischer nfischer added this to the v0.8.0 milestone Dec 21, 2016
@nfischer nfischer requested a review from freitagbr December 21, 2016 05:52
@nfischer nfischer added electron Bugs specific to the electron framework refactor and removed bash compat Compatibility issues with bash or POSIX behavior blocked labels Dec 21, 2016
@nfischer nfischer modified the milestones: v0.7.x, v0.8.0 Dec 21, 2016
@nfischer
Copy link
Copy Markdown
Member Author

nfischer commented Jan 8, 2017

@freitagbr PTAL

function execSync(cmd, opts, pipe) {
if (!common.execPath) {
common.error('Unable to find a path to the node binary. Please manually set common.execPath');
}
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

What about execAsync? Maybe this should go in _exec.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@freitagbr execAsync doesn't actually depend on it. It uses child_process.exec() directly, instead of our execSync which uses something like child_process.execSync(process.execPath + ' script.js'). You can do a simple search for process.execPath and you'll see it only shows up in execSync.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Ok, that makes sense.

src/common.js Outdated
// Expose the path to the NodeJS binary to utilities
var isElectron = Boolean(process.versions.electron);
if (!isElectron) {
exports.execPath = process.execPath;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Maybe common.execPath should be configurable through shell.config?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Probably the better spot for it. We'll have to be careful with the name we come up for in #534 (which is a different feature, that currently sounds very similar).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Should we wait for #534 to implement that then?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

We'll just wait on #534. I'm not convinced if that's the best approach, since it's something that can easily be implemented by users of our module.

@nfischer
Copy link
Copy Markdown
Member Author

nfischer commented Jan 8, 2017

Blocked on #641. I'll update this after that's merged.

@freitagbr
Copy link
Copy Markdown
Contributor

#641 is merged, so this can go through now.

@freitagbr freitagbr removed the blocked label Jan 8, 2017
Switch to using common.execPath instead of process.execPath directly and warn
electron users if we were unable to find the correct path to NodeJS.
@nfischer
Copy link
Copy Markdown
Member Author

nfischer commented Jan 8, 2017

Updates:

  • common.execPath ➡️ common.config.execPath
  • Error message for invalid execPath is changed: Please manually set common.execPath ➡️ Please manually set config.execPath

📜 I didn't document the change in the README because it affects very few people. I'll document it in the wiki page for electron support after merge

@freitagbr
Copy link
Copy Markdown
Contributor

CI failures are unrelated, so LGTM.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

electron Bugs specific to the electron framework refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants