Permalink
Browse files

Fix version checking for nodejs 0.10.0

Version checking should now be a bit more future proof.
Could possibly do with some error handling in case process.versions.node
goes away in future.
  • Loading branch information...
1 parent fe2eecd commit 07adb7dc59fdf3f2625072c7341396c23d575961 @blutack blutack committed Mar 15, 2013
Showing with 5 additions and 2 deletions.
  1. +5 −2 tools/dependencies/launch_helper.js
@@ -10,10 +10,13 @@
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
////////////////////////////////////
-var min_node_version = 'v0.6.0';
+var min_node_version = '0.6.0';
-if (process.version < min_node_version) {
+if (flattenVersion(process.versions.node) < flattenVersion(min_node_version)) {
console.error('Your version of node seems to be too old. Please upgrade to a more recent version of node (>= '+min_node_version+')');
process.exit(1);
}
+function flattenVersion(version) {
+ return parseInt(version.replace(/\./g,''));
+}

0 comments on commit 07adb7d

Please sign in to comment.