diff options
author | ccalvarin <ccalvarin@google.com> | 2018-03-29 11:13:24 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-03-29 11:14:35 -0700 |
commit | c5a5880c4797a60ef123d6ba8b0db4f984ebf36d (patch) | |
tree | daa36705d5141b6fe2e3a4b577ecd242aed6825f /src/main/cpp/blaze_util_freebsd.cc | |
parent | 083be7a8f972a060e4e263819e0e9080b5aa6929 (diff) |
Remove pdie.
pdie and die are pretty similar, pdie just adds the errno string or equivalent from GetLastErrorString(). Make this explicit. This makes message formatting more clear in preparation for moving these all to BAZEL_LOG.
RELNOTES: None.
PiperOrigin-RevId: 190957255
Diffstat (limited to 'src/main/cpp/blaze_util_freebsd.cc')
-rw-r--r-- | src/main/cpp/blaze_util_freebsd.cc | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/main/cpp/blaze_util_freebsd.cc b/src/main/cpp/blaze_util_freebsd.cc index 5c516785f8..e105e37ff3 100644 --- a/src/main/cpp/blaze_util_freebsd.cc +++ b/src/main/cpp/blaze_util_freebsd.cc @@ -39,7 +39,7 @@ namespace blaze { using blaze_util::die; -using blaze_util::pdie; +using blaze_util::GetLastErrorString; using std::string; string GetOutputRoot() { @@ -79,12 +79,14 @@ string GetSelfPath() { auto p = procstat_getprocs(procstat, KERN_PROC_PID, pid, &n); if (p) { if (n != 1) { - pdie(blaze_exit_code::INTERNAL_ERROR, - "expected exactly one process from procstat_getprocs, got %d", n); + die(blaze_exit_code::INTERNAL_ERROR, + "expected exactly one process from procstat_getprocs, got %d: %s", n, + GetLastErrorString().c_str()); } auto r = procstat_getpathname(procstat, p, buffer, PATH_MAX); if (r != 0) { - pdie(blaze_exit_code::INTERNAL_ERROR, "error procstat_getpathname"); + die(blaze_exit_code::INTERNAL_ERROR, "procstat_getpathname failed: %s", + GetLastErrorString().c_str()); } procstat_freeprocs(procstat, p); } @@ -116,8 +118,9 @@ string GetProcessCWD(int pid) { string cwd; if (p) { if (n != 1) { - pdie(blaze_exit_code::INTERNAL_ERROR, - "expected exactly one process from procstat_getprocs, got %d", n); + die(blaze_exit_code::INTERNAL_ERROR, + "expected exactly one process from procstat_getprocs, got %d: %s", n, + GetLastErrorString().c_str()); } auto files = procstat_getfiles(procstat, p, false); filestat *entry; |