[PATCH] D49451: [windows] Use a well-known path for ComSpec if we fail to retrieve it

Stella Stamenova via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed Jul 18 08:27:14 PDT 2018


This revision was automatically updated to reflect the committed changes.
Closed by commit rL337395: [windows] Use a well-known path for ComSpec if we fail to retrieve it (authored by stella.stamenova, committed by ).

Changed prior to commit:
  https://reviews.llvm.org/D49451?vs=155957&id=156085#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D49451

Files:
  lldb/trunk/source/Host/windows/HostInfoWindows.cpp


Index: lldb/trunk/source/Host/windows/HostInfoWindows.cpp
===================================================================
--- lldb/trunk/source/Host/windows/HostInfoWindows.cpp
+++ lldb/trunk/source/Host/windows/HostInfoWindows.cpp
@@ -98,9 +98,14 @@
 }
 
 FileSpec HostInfoWindows::GetDefaultShell() {
+  // Try to retrieve ComSpec from the environment. On the rare occasion
+  // that it fails, try a well-known path for ComSpec instead.
+
   std::string shell;
-  GetEnvironmentVar("ComSpec", shell);
-  return FileSpec(shell, false);
+  if (GetEnvironmentVar("ComSpec", shell))
+    return FileSpec(shell, false);
+
+  return FileSpec("C:\\Windows\\system32\\cmd.exe", false);
 }
 
 bool HostInfoWindows::GetEnvironmentVar(const std::string &var_name,


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D49451.156085.patch
Type: text/x-patch
Size: 760 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20180718/3489110b/attachment.bin>


More information about the llvm-commits mailing list