FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

Detect in script if io.js or node is running · Issue #1447 · nodejs/node · GitHub

Repository navigation

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

Description

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

Activity

  1. monsanto commented on Apr 17, 2015

    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.

  2. meandmycode commented on Apr 17, 2015

    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.

  3. jbergstroem commented on Apr 17, 2015

    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.

  4. tellnes commented on Apr 17, 2015

    Contributor

    Related #493

  5. silverwind commented on Apr 17, 2015

    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/

  6. Fishrock123 commented on Apr 17, 2015

    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)

  7. isavegas commented on Apr 22, 2015

    Author

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

  8. stevenvachon commented on May 1, 2015

    +1000 @isavegas

  9. dougwilson commented on May 5, 2015

    Member

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

    Besides, this advice is broken now with 2.0.0 ;)

  10. jbergstroem commented on May 5, 2015

    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

Metadata

Metadata

Assignees

No one assigned

    Labels

    questionIssues asking questions about Node.js.

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions


      Back | FazBrowse Home | New Git URL