diff options
| author | Nat Goodspeed <nat@lindenlab.com> | 2023-07-08 11:08:16 -0400 | 
|---|---|---|
| committer | Nat Goodspeed <nat@lindenlab.com> | 2023-07-08 11:08:16 -0400 | 
| commit | 1ec6c744048a2905b0f2bf83f035a8fb8798dbdf (patch) | |
| tree | 010121ef262e206a84efde7fcc03d9059e071e5d /indra/llcommon | |
| parent | f37d2c307617302f2ed5dfead7e280da54a7d3e4 (diff) | |
SL-18837: Set APR_LOG once for the whole job
instead of a new value for each LLProcess::create() invocation.
Since the internal apr_log() function only looks at APR_LOG once per process,
the first test (which succeeded, hence no log file dump) left the log file
open with that same original pathname. Resetting the APR_LOG environment
variable for subsequent runs only made the new code in llprocess_test look for
files that were never created.
Diffstat (limited to 'indra/llcommon')
| -rw-r--r-- | indra/llcommon/tests/llprocess_test.cpp | 32 | 
1 files changed, 16 insertions, 16 deletions
| diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp index 6fcc6fd8aa..a01ec84547 100644 --- a/indra/llcommon/tests/llprocess_test.cpp +++ b/indra/llcommon/tests/llprocess_test.cpp @@ -151,10 +151,6 @@ struct PythonProcessLauncher      /// Launch Python script; verify that it launched      void launch()      { -        std::string logpath{ NamedTempFile::temp_path("apr", ".log").string() }; -#if LL_WINDOWS -        _putenv_s("APR_LOG", logpath.c_str()); -#endif          try          {              mPy = LLProcess::create(mParams); @@ -162,21 +158,25 @@ struct PythonProcessLauncher          }          catch (const tut::failure&)          { -            std::ifstream inf(logpath.c_str()); -            if (! inf.is_open()) -            { -                LL_WARNS() << "Couldn't open '" << logpath << "'" << LL_ENDL; -            } -            else +            const char* APR_LOG = getenv("APR_LOG"); +            if (APR_LOG && *APR_LOG)              { -                LL_WARNS() << "==============================" << LL_ENDL; -                LL_WARNS() << "From '" << logpath << "':" << LL_ENDL; -                std::string line; -                while (std::getline(inf, line)) +                std::ifstream inf(APR_LOG); +                if (! inf.is_open())                  { -                    LL_WARNS() << line << LL_ENDL; +                    LL_WARNS() << "Couldn't open '" << APR_LOG << "'" << LL_ENDL; +                } +                else +                { +                    LL_WARNS() << "==============================" << LL_ENDL; +                    LL_WARNS() << "From '" << APR_LOG << "':" << LL_ENDL; +                    std::string line; +                    while (std::getline(inf, line)) +                    { +                        LL_WARNS() << line << LL_ENDL; +                    } +                    LL_WARNS() << "==============================" << LL_ENDL;                  } -                LL_WARNS() << "==============================" << LL_ENDL;              }              throw;          } | 
