On 22/04/2019 22:27, Davide Italiano via lldb-commits wrote:
Author: davide
Date: Mon Apr 22 13:27:10 2019
New Revision: 358918

URL: http://llvm.org/viewvc/llvm-project?rev=358918&view=rev
Log:
[EditLineTest] Not always TERM is available, e.g. on some bots.

Modified:
     lldb/trunk/unittests/Editline/EditlineTest.cpp

Modified: lldb/trunk/unittests/Editline/EditlineTest.cpp
URL: 
http://llvm.org/viewvc/llvm-project/lldb/trunk/unittests/Editline/EditlineTest.cpp?rev=358918&r1=358917&r2=358918&view=diff
==============================================================================
--- lldb/trunk/unittests/Editline/EditlineTest.cpp (original)
+++ lldb/trunk/unittests/Editline/EditlineTest.cpp Mon Apr 22 13:27:10 2019
@@ -244,17 +244,19 @@ private:
    EditlineAdapter _el_adapter;
    std::shared_ptr<std::thread> _sp_output_thread;
+protected:
+  bool _has_term = true;
+
  public:
    void SetUp() {
      FileSystem::Initialize();
// We need a TERM set properly for editline to work as expected.
-    setenv("TERM", "vt100", 1);
+    if (setenv("TERM", "vt100", 1) != 0)
+      _has_term = false;

I'm confused as to what is this trying to solve. Judging by the manpage (which also agrees with my intuition) the setenv call can only fail under two conditions: - "name (first arg) is NULL, points to a string of length 0, or contains an '=' character". This is clearly not the case here. - "Insufficient memory to add a new variable to the environment". While technically possible, I find that highly unlikely, as you'd run into a lot more problems if the system was so severely memory-constrained.

I suspect this is only covering up some other problem. Can you elaborate on how you've arrived at this patch?

pl

_______________________________________________
lldb-commits mailing list
lldb-commits@lists.llvm.org
https://lists.llvm.org/cgi-bin/mailman/listinfo/lldb-commits

Reply via email to