/*1Copyright 2013 Daniel Wirtz <[email protected]>23Licensed under the Apache License, Version 2.0 (the "License");4you may not use this file except in compliance with the License.5You may obtain a copy of the License at67http://www.apache.org/licenses/LICENSE-2.089Unless required by applicable law or agreed to in writing, software10distributed under the License is distributed on an "AS IS" BASIS,11WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.12See the License for the specific language governing permissions and13limitations under the License.14*/1516/**17* node-harmonize (c) 2013 Daniel Wirtz <[email protected]>18* Released under the Apache License, Version 2.019* see: https://github.com/dcodeIO/node-harmonize for details20*/21var child_process = require("child_process");22var isIojs = require("is-iojs");2324module.exports = function() {25if (typeof Proxy == 'undefined') { // We take direct proxies as our marker26var v = process.versions.node.split(".");2728if (!isIojs && v[0] == 0 && v[1] < 8) {29throw("harmonize requires at least node v0.8");30}3132// harmony flag is unnecessary in io and beginning with node v0.1233if(isIojs || (!isIojs && v[0] == 0 && v[1] > 12)) {34return;35}3637var node = child_process.spawn(process.argv[0], ['--harmony', '--harmony-proxies'].concat(process.argv.slice(1)), { stdio: 'inherit' });38node.on("close", function(code) {39process.exit(code);40});4142// Interrupt process flow in the parent43process.once("uncaughtException", function(e) {});44throw("harmony");45}46};4748// Usage: require("harmonize")();495051