Skip to content

Commit

Permalink
fixup! src: consolidate exit codes in the code base
Browse files Browse the repository at this point in the history
  • Loading branch information
joyeecheung committed Sep 28, 2022
1 parent fa76b0d commit c49c504
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion src/api/hooks.cc
Expand Up @@ -53,7 +53,7 @@ Maybe<bool> EmitProcessBeforeExit(Environment* env) {
Nothing<bool>() : Just(true);
}

ExitCode EmitExitInternal(Environment* env) {
static ExitCode EmitExitInternal(Environment* env) {
return EmitProcessExitInternal(env).FromMaybe(ExitCode::kGenericUserError);
}

Expand Down
5 changes: 3 additions & 2 deletions src/env.cc
Expand Up @@ -1521,8 +1521,9 @@ void Environment::Exit(ExitCode exit_code) {
uv_os_getpid(), thread_id());
}

fprintf(
stderr, "WARNING: Exited the environment with code %d\n", exit_code);
fprintf(stderr,
"WARNING: Exited the environment with code %d\n",
static_cast<int>(exit_code));
PrintStackTrace(isolate(),
StackTrace::CurrentStackTrace(
isolate(), stack_trace_limit(), StackTrace::kDetailed));
Expand Down
20 changes: 10 additions & 10 deletions src/node.cc
Expand Up @@ -626,10 +626,10 @@ void ResetStdio() {
#endif // __POSIX__
}

ExitCode ProcessGlobalArgsInternal(std::vector<std::string>* args,
std::vector<std::string>* exec_args,
std::vector<std::string>* errors,
OptionEnvvarSettings settings) {
static ExitCode ProcessGlobalArgsInternal(std::vector<std::string>* args,
std::vector<std::string>* exec_args,
std::vector<std::string>* errors,
OptionEnvvarSettings settings) {
// Parse a few arguments which are specific to Node.
std::vector<std::string> v8_args;

Expand Down Expand Up @@ -717,7 +717,7 @@ static std::atomic_bool init_called{false};

// TODO(addaleax): Turn this into a wrapper around InitializeOncePerProcess()
// (with the corresponding additional flags set), then eventually remove this.
ExitCode InitializeNodeWithArgsInternal(
static ExitCode InitializeNodeWithArgsInternal(
std::vector<std::string>* argv,
std::vector<std::string>* exec_argv,
std::vector<std::string>* errors,
Expand Down Expand Up @@ -839,10 +839,10 @@ int InitializeNodeWithArgs(std::vector<std::string>* argv,
InitializeNodeWithArgsInternal(argv, exec_argv, errors, flags));
}

std::unique_ptr<InitializationResultImpl> InitializeOncePerProcessInternal(
const std::vector<std::string>& args,
ProcessInitializationFlags::Flags flags =
ProcessInitializationFlags::kNoFlags) {
static std::unique_ptr<InitializationResultImpl>
InitializeOncePerProcessInternal(const std::vector<std::string>& args,
ProcessInitializationFlags::Flags flags =
ProcessInitializationFlags::kNoFlags) {
auto result = std::make_unique<InitializationResultImpl>();
result->args_ = args;

Expand Down Expand Up @@ -1165,7 +1165,7 @@ ExitCode LoadSnapshotDataAndRun(const SnapshotData** snapshot_data_ptr,
return exit_code;
}

ExitCode StartInternal(int argc, char** argv) {
static ExitCode StartInternal(int argc, char** argv) {
CHECK_GT(argc, 0);

// Hack around with the argv pointer. Used for process.title = "blah".
Expand Down

0 comments on commit c49c504

Please sign in to comment.