Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Move execPath into common #633

@nfischer

Description

@nfischer

We should replace process.execPath with something like common.execPath. While process.execPath does not always point to NodeJS (like if it's running within electron), common.execPath ideally should, allowing us to reliably use the within exec and other utilities.

At startup, we can set common.execPath to:

  • process.execPath if not within electron
  • otherwise use which('node') if it returns something
  • otherwise use which('nodejs') if it returns something
  • otherwise we can leave it null and fail early whenever we try to use it (like in shell.exec), displaying a descriptive error message (at least an improvement over the current cryptic error message).

Also, this would allow electron users to manually override common.execPath with the hardcoded path of their NodeJS binary if the above approach fails. While not ideal, that should at least be a suitable workaround until we can figure out a solid way to reliably get a path to the current node instance.

Linking this to #480

Metadata

Metadata

Assignees

Labels

electronBugs specific to the electron frameworkrefactor

Type

No type

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions