Bazel client: add comments, delete dead code In this change: - add TODOs and comments - inline blaze::ExitImmediately at call sites -- PiperOrigin-RevId: 142671757 MOS_MIGRATED_REVID=142671757
diff --git a/src/main/cpp/blaze_util_platform.h b/src/main/cpp/blaze_util_platform.h index 9fd0338..c196dd2 100644 --- a/src/main/cpp/blaze_util_platform.h +++ b/src/main/cpp/blaze_util_platform.h
@@ -185,11 +185,6 @@ void UnsetEnv(const std::string& name); -// Terminate the process immediately. -// This is a wrapper around POSIX's _exit(2). -// WARNING! This function can be called from a signal handler! -ATTRIBUTE_NORETURN void ExitImmediately(int exit_code); - // Ensure we have open file descriptors for stdin/stdout/stderr. void SetupStdStreams();
diff --git a/src/main/cpp/blaze_util_posix.cc b/src/main/cpp/blaze_util_posix.cc index 9be1c4e..6c22370 100644 --- a/src/main/cpp/blaze_util_posix.cc +++ b/src/main/cpp/blaze_util_posix.cc
@@ -66,7 +66,7 @@ if (SignalHandler::Get().GetGlobals()->server_pid != -1) { KillServerProcess(SignalHandler::Get().GetGlobals()->server_pid); } - ExitImmediately(1); + _exit(1); } SigPrintf( "\n%s caught interrupt signal; shutting down.\n\n", @@ -388,10 +388,6 @@ unsetenv(name.c_str()); } -ATTRIBUTE_NORETURN void ExitImmediately(int exit_code) { - _exit(exit_code); -} - void SetupStdStreams() { // Set non-buffered output mode for stderr/stdout. The server already // line-buffers messages where it makes sense, so there's no need to do set
diff --git a/src/main/cpp/blaze_util_windows.cc b/src/main/cpp/blaze_util_windows.cc index fbabf07..47882e6 100644 --- a/src/main/cpp/blaze_util_windows.cc +++ b/src/main/cpp/blaze_util_windows.cc
@@ -132,7 +132,7 @@ if (SignalHandler::Get().GetGlobals()->server_pid != -1) { KillServerProcess(SignalHandler::Get().GetGlobals()->server_pid); } - ExitImmediately(1); + _exit(1); } SigPrintf( "\n%s caught interrupt signal; shutting down.\n\n", @@ -1145,15 +1145,6 @@ #endif // COMPILER_MSVC } -ATTRIBUTE_NORETURN void ExitImmediately(int exit_code) { -#ifdef COMPILER_MSVC - // TODO(bazel-team): implement this. - pdie(255, "blaze::ExitImmediately is not implemented on Windows"); -#else // not COMPILER_MSVC - _exit(exit_code); -#endif // COMPILER_MSVC -} - void SetupStdStreams() { #ifdef COMPILER_MSVC // TODO(bazel-team): implement this.
diff --git a/src/main/cpp/util/file_platform.h b/src/main/cpp/util/file_platform.h index daed199..5354052 100644 --- a/src/main/cpp/util/file_platform.h +++ b/src/main/cpp/util/file_platform.h
@@ -89,6 +89,7 @@ bool MakeDirectories(const std::string &path, unsigned int mode); // Returns the current working directory. +// The path is platform-specific (e.g. Windows path of Windows) and absolute. std::string GetCwd(); // Changes the current working directory to `path`, returns true upon success.