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

Detect in script if io.js or node is running #1447

Closed
isavegas opened this issue Apr 17, 2015 · 10 comments
Closed

Detect in script if io.js or node is running #1447

isavegas opened this issue Apr 17, 2015 · 10 comments
Labels
question Issues that look for answers.

Comments

@isavegas
Copy link

I would absolutely adore the ability to check whether Node or io.js is running the script. Perhaps via changing

process.versions.node

to

process.versions.iojs

As it is, the best way seems to be to have the script fork a child_process of the executable that started it, with the -h flag, then to parse for iojs.org

@monsanto
Copy link
Contributor

Since you mentioned it, if process.versions.node does not start with "0.", it's io.js. Might change in the future, but node is pretty slow moving.

@meandmycode
Copy link

I believe you check navigator.userAgent contains "IE".

In all seriousness though I'd be curious what scenario's you have that need to know. Perhaps there's a better way of branching.

@jbergstroem
Copy link
Member

Additionally, if io.js and nodejs merges - introducing process.versions.iojs would just complicate things. Since node hasn't bumped to 1.0 just yet, what @monsanto suggested is probably your best bet.

@jbergstroem jbergstroem added the question Issues that look for answers. label Apr 17, 2015
@tellnes
Copy link
Contributor

tellnes commented Apr 17, 2015

Related #493

@silverwind
Copy link
Contributor

Yeah, the real fix will hopefully be with #493, but it seems a bit stale.

Another alternative is to check process.execPath like I do here:

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

@Fishrock123
Copy link
Contributor

Check if process.versions.node's major (first number) is 1 (or use node-semver). There have been numerous discussions about this which can be linked to (including the aforementioned #493)

@isavegas
Copy link
Author

Work-arounds like these are what caused Microsoft to have to skip an entire version for Windows.

@stevenvachon
Copy link

+1000 @isavegas

@dougwilson
Copy link
Member

Check if process.versions.node's major (first number) is 1

Besides, this advice is broken now with 2.0.0 ;)

@jbergstroem
Copy link
Member

s/is/is equal or greater than/g 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
question Issues that look for answers.
Projects
None yet
Development

No branches or pull requests

9 participants