Local<v8::Script> script = v8::Script::Compile(source, filename);
if (script.IsEmpty()) {
ReportException(try_catch, true);
- exit(1);
+ exit(3);
}
Local<Value> result = script->Run();
if (result.IsEmpty()) {
ReportException(try_catch, true);
- exit(1);
+ exit(4);
}
return scope.Close(result);
} else {
fprintf(stderr, "FATAL ERROR: %s\n", message);
}
- exit(1);
+ exit(5);
}
void FatalException(TryCatch &try_catch) {
// failed before the process._fatalException function was added!
// this is probably pretty bad. Nothing to do but report and exit.
ReportException(try_catch, true);
- exit(1);
+ exit(6);
}
Local<Function> fatal_f = Local<Function>::Cast(fatal_v);
if (fatal_try_catch.HasCaught()) {
// the fatal exception function threw, so we must exit
ReportException(fatal_try_catch, true);
- exit(1);
+ exit(7);
}
if (false == caught->BooleanValue()) {
ReportException(try_catch, true);
- exit(1);
+ exit(8);
}
}
static void SignalExit(int signal) {
uv_tty_reset_mode();
- _exit(1);
+ _exit(128 + signal);
}
f->Call(global, 1, args);
if (try_catch.HasCaught()) {
- ReportException(try_catch, true);
- exit(11);
+ FatalException(try_catch);
}
}
if (p) fprintf(stderr, "Debug port must be in range 1025 to 65535.\n");
PrintHelp();
- exit(1);
+ exit(12);
}
static void PrintHelp() {
// argument to -p and --print is optional
if (is_eval == true && i + 1 >= argc) {
fprintf(stderr, "Error: %s requires an argument\n", arg);
- exit(1);
+ exit(13);
}
print_eval = print_eval || is_print;
// throw accidently error
process.nextTick(function() {
- throw 'accidently error';
+ console.error('about to throw');
+ throw new Error('accidently error');
});
}
master.on('exit', function(code) {
// Check that the cluster died accidently
- existMaster = (code === 1);
+ existMaster = !!code;
// Give the workers time to shut down
setTimeout(checkWorkers, 200);