62 lines
1.3 KiB
JavaScript
Executable File
62 lines
1.3 KiB
JavaScript
Executable File
#!/usr/bin/env node
|
|
|
|
/**
|
|
* This tiny wrapper file checks for known node flags and appends them
|
|
* when found, before invoking the "real" _6to5-node(1) executable.
|
|
*/
|
|
|
|
var spawn = require("child_process").spawn;
|
|
var args = ["--harmony", __dirname + "/_6to5-node"];
|
|
|
|
process.argv.slice(2).forEach(function(arg){
|
|
var flag = arg.split("=")[0];
|
|
|
|
switch (flag) {
|
|
case "-d":
|
|
args.unshift("--debug");
|
|
break;
|
|
|
|
case "debug":
|
|
case "--debug":
|
|
case "--debug-brk":
|
|
args.unshift(arg);
|
|
break;
|
|
|
|
case "-gc":
|
|
case "--expose-gc":
|
|
args.unshift("--expose-gc");
|
|
break;
|
|
|
|
case "--gc-global":
|
|
case "--harmony":
|
|
case "--harmony-proxies":
|
|
case "--harmony-collections":
|
|
case "--harmony-generators":
|
|
case "--no-deprecation":
|
|
case "--prof":
|
|
case "--throw-deprecation":
|
|
case "--trace-deprecation":
|
|
args.unshift(arg);
|
|
break;
|
|
|
|
default:
|
|
if (arg.indexOf("--trace") === 0) {
|
|
args.unshift(arg);
|
|
} else {
|
|
args.push(arg);
|
|
}
|
|
break;
|
|
}
|
|
});
|
|
|
|
var proc = spawn(process.argv[0], args, { stdio: "inherit" });
|
|
proc.on("exit", function (code, signal) {
|
|
process.on("exit", function () {
|
|
if (signal) {
|
|
process.kill(process.pid, signal);
|
|
} else {
|
|
process.exit(code);
|
|
}
|
|
});
|
|
});
|