diff options
author | Laszlo Csomor <laszlocsomor@google.com> | 2018-04-24 01:44:17 -0700 |
---|---|---|
committer | Copybara-Service <copybara-piper@google.com> | 2018-04-24 01:46:08 -0700 |
commit | 8c400c81f224813605dcc9d44d259180a978950a (patch) | |
tree | b49a3e7a314beca8b20f633ea11985f20ca83382 /src/tools/launcher | |
parent | ce2aa957c89ea7d7850aae767733f4e1f7c73e95 (diff) |
windows,client: fix error reporting
Fix error reporting in the path conversion methods
of the Bazel client. Previously the error
reporting logic used GetLastErrorString in places
where it was not appropriate (i.e. it was not a
failed Windows API call that caused an error).
This cleanup prepares removing the concept of the
MSYS root from the Bazel client, since MSYS paths
are no longer supported and we want to cut Bazel's
dependency on Bash (thus MSYS) completely.
See https://github.com/bazelbuild/bazel/issues/4319
Change-Id: Ie50a20e0ee0c572592f637340a2f2948c7f53088
Closes #5072.
Change-Id: Ie50a20e0ee0c572592f637340a2f2948c7f53088
PiperOrigin-RevId: 194052665
Diffstat (limited to 'src/tools/launcher')
-rw-r--r-- | src/tools/launcher/util/launcher_util.cc | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/src/tools/launcher/util/launcher_util.cc b/src/tools/launcher/util/launcher_util.cc index dd01a39676..573a99669a 100644 --- a/src/tools/launcher/util/launcher_util.cc +++ b/src/tools/launcher/util/launcher_util.cc @@ -74,8 +74,10 @@ void PrintError(const char* format, ...) { wstring AsAbsoluteWindowsPath(const char* path) { wstring wpath; - if (!blaze_util::AsAbsoluteWindowsPath(path, &wpath)) { - die("Couldn't convert %s to absoulte Windows path.", path); + string error; + if (!blaze_util::AsAbsoluteWindowsPath(path, &wpath, &error)) { + die("Couldn't convert %s to absolute Windows path: %s", path, + error.c_str()); } return wpath; } @@ -173,8 +175,9 @@ string GetRandomStr(size_t len) { } bool NormalizePath(const string& path, string* result) { - if (!blaze_util::AsWindowsPath(path, result)) { - PrintError("Failed to normalize %s", path.c_str()); + string error; + if (!blaze_util::AsWindowsPath(path, result, &error)) { + PrintError("Failed to normalize %s: %s", path.c_str(), error.c_str()); return false; } std::transform(result->begin(), result->end(), result->begin(), ::tolower); |