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

Expose runtime name via process.name? #780

Closed
bitinn opened this issue Feb 10, 2015 · 8 comments
Closed

Expose runtime name via process.name? #780

bitinn opened this issue Feb 10, 2015 · 8 comments
Labels
discuss Issues opened for discussions and feedbacks.

Comments

@bitinn
Copy link

bitinn commented Feb 10, 2015

I had node.js 0.12 before installing io.js 1.1.0, and was trying to figure out if npm now use iojs instead of node.

Currently npm --verbose will print following for io.js

npm info it worked if it ends with ok
npm verb cli [ 'node', '/usr/local/bin/npm', '--verbose' ]
npm info using npm@2.5.0
npm info using node@v1.1.0
npm verb node symlink /usr/local/bin/node

While from version number it's quite clear that npm is using io.js, if we expose runtime name in some fashion then npm can be improved with a clearer message.

ref: https://github.com/npm/npm/blob/master/bin/npm-cli.js#L58

(if there are existing ways, then i will open a PR on npm repo)

@targos
Copy link
Member

targos commented Feb 10, 2015

related to #493

@bitinn
Copy link
Author

bitinn commented Feb 10, 2015

oh wait, now my node -v outputs v1.1.0, so to make it compatible, node is an alias to iojs.

@bitinn bitinn closed this as completed Feb 10, 2015
@bitinn bitinn reopened this Feb 10, 2015
@bitinn
Copy link
Author

bitinn commented Feb 10, 2015

I thought npm could just use process.argv to figure out the right name... but it's called with node, not iojs, so a name still make sense?

@bnoordhuis
Copy link
Member

You can use something like process.execPath.endsWith && process.execPath.endsWith('iojs') although it should be noted that doesn't currently quite work on Windows.

@silverwind
Copy link
Contributor

@bitinn: you might be interested in this tiny module:

https://github.com/silverwind/detect-engine

(Thanks ben for the inspiration)

@bitinn
Copy link
Author

bitinn commented Feb 11, 2015

thx @beanieboi @silverwind, looks like we have enough tool to do this now, close for now.

@bitinn
Copy link
Author

bitinn commented Feb 13, 2015

Looks like npm would also prefer a solution either through package.json or some runtime api, see #269

And I agree, reading execPath is sort of a hack, when the runtime knows itself perfectly well.

But similar suggestions have been shot down before (see #491 and #493), so hmmm, re-open this until a resolution is reached?

@silverwind
Copy link
Contributor

Wait for #493, I suppose?

@mscdex mscdex added enhancement discuss Issues opened for discussions and feedbacks. labels Mar 12, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discuss Issues opened for discussions and feedbacks.
Projects
None yet
Development

No branches or pull requests

6 participants