Skip to content

Commit b439af8

Browse files
committed
fixup! src: consolidate exit codes in the code base
1 parent fa76b0d commit b439af8

File tree

6 files changed

+22
-18
lines changed

6 files changed

+22
-18
lines changed

lib/internal/debugger/inspect.js

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,12 @@ const { 0: InspectClient, 1: createRepl } =
4444
const debuglog = util.debuglog('inspect');
4545

4646
const { ERR_DEBUGGER_STARTUP_ERROR } = require('internal/errors').codes;
47-
const { exitCodes: {
48-
kGenericUserError, kNoFailure
49-
} } = internalBinding('errors');
47+
const {
48+
exitCodes: {
49+
kGenericUserError,
50+
kNoFailure,
51+
},
52+
} = internalBinding('errors');
5053

5154
async function portIsFree(host, port, timeout = 3000) {
5255
if (port === 0) return; // Binding to a random port.

lib/internal/main/watch_mode.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ const {
1414
} = require('internal/process/pre_execution');
1515
const {
1616
triggerUncaughtException,
17-
exitCodes: { kNoFailure }
17+
exitCodes: { kNoFailure },
1818
} = internalBinding('errors');
1919
const { getOptionValue } = require('internal/options');
2020
const { emitExperimentalWarning } = require('internal/util');

lib/internal/process/promises.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ const { deprecate } = require('internal/util');
2525
const {
2626
noSideEffectsToString,
2727
triggerUncaughtException,
28-
exitCodes: { kGenericUserError }
28+
exitCodes: { kGenericUserError },
2929
} = internalBinding('errors');
3030

3131
const {

src/api/hooks.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ Maybe<bool> EmitProcessBeforeExit(Environment* env) {
5353
Nothing<bool>() : Just(true);
5454
}
5555

56-
ExitCode EmitExitInternal(Environment* env) {
56+
static ExitCode EmitExitInternal(Environment* env) {
5757
return EmitProcessExitInternal(env).FromMaybe(ExitCode::kGenericUserError);
5858
}
5959

src/env.cc

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1521,8 +1521,9 @@ void Environment::Exit(ExitCode exit_code) {
15211521
uv_os_getpid(), thread_id());
15221522
}
15231523

1524-
fprintf(
1525-
stderr, "WARNING: Exited the environment with code %d\n", exit_code);
1524+
fprintf(stderr,
1525+
"WARNING: Exited the environment with code %d\n",
1526+
static_cast<int>(exit_code));
15261527
PrintStackTrace(isolate(),
15271528
StackTrace::CurrentStackTrace(
15281529
isolate(), stack_trace_limit(), StackTrace::kDetailed));

src/node.cc

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -626,10 +626,10 @@ void ResetStdio() {
626626
#endif // __POSIX__
627627
}
628628

629-
ExitCode ProcessGlobalArgsInternal(std::vector<std::string>* args,
630-
std::vector<std::string>* exec_args,
631-
std::vector<std::string>* errors,
632-
OptionEnvvarSettings settings) {
629+
static ExitCode ProcessGlobalArgsInternal(std::vector<std::string>* args,
630+
std::vector<std::string>* exec_args,
631+
std::vector<std::string>* errors,
632+
OptionEnvvarSettings settings) {
633633
// Parse a few arguments which are specific to Node.
634634
std::vector<std::string> v8_args;
635635

@@ -717,7 +717,7 @@ static std::atomic_bool init_called{false};
717717

718718
// TODO(addaleax): Turn this into a wrapper around InitializeOncePerProcess()
719719
// (with the corresponding additional flags set), then eventually remove this.
720-
ExitCode InitializeNodeWithArgsInternal(
720+
static ExitCode InitializeNodeWithArgsInternal(
721721
std::vector<std::string>* argv,
722722
std::vector<std::string>* exec_argv,
723723
std::vector<std::string>* errors,
@@ -839,10 +839,10 @@ int InitializeNodeWithArgs(std::vector<std::string>* argv,
839839
InitializeNodeWithArgsInternal(argv, exec_argv, errors, flags));
840840
}
841841

842-
std::unique_ptr<InitializationResultImpl> InitializeOncePerProcessInternal(
843-
const std::vector<std::string>& args,
844-
ProcessInitializationFlags::Flags flags =
845-
ProcessInitializationFlags::kNoFlags) {
842+
static std::unique_ptr<InitializationResultImpl>
843+
InitializeOncePerProcessInternal(const std::vector<std::string>& args,
844+
ProcessInitializationFlags::Flags flags =
845+
ProcessInitializationFlags::kNoFlags) {
846846
auto result = std::make_unique<InitializationResultImpl>();
847847
result->args_ = args;
848848

@@ -1165,7 +1165,7 @@ ExitCode LoadSnapshotDataAndRun(const SnapshotData** snapshot_data_ptr,
11651165
return exit_code;
11661166
}
11671167

1168-
ExitCode StartInternal(int argc, char** argv) {
1168+
static ExitCode StartInternal(int argc, char** argv) {
11691169
CHECK_GT(argc, 0);
11701170

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

0 commit comments

Comments
 (0)