summaryrefslogtreecommitdiff
path: root/indra/llcommon/tests
diff options
context:
space:
mode:
authorNat Goodspeed <nat@lindenlab.com>2023-07-07 17:31:50 -0400
committerNat Goodspeed <nat@lindenlab.com>2023-07-07 17:31:50 -0400
commit1fc8758458c99b3a41965e33b3c62613c83e403a (patch)
treeb9f6db5eeac5b7d1824578ca7338c7faf9ac49f7 /indra/llcommon/tests
parentc4b5d089dad5680a0dd12b2d386b692318eb5c58 (diff)
SL-18837: Coax APR to log LLProcess launch attempts; show log file.
Diffstat (limited to 'indra/llcommon/tests')
-rw-r--r--indra/llcommon/tests/llprocess_test.cpp34
1 files changed, 32 insertions, 2 deletions
diff --git a/indra/llcommon/tests/llprocess_test.cpp b/indra/llcommon/tests/llprocess_test.cpp
index c7d1a2c86a..fbddc7f909 100644
--- a/indra/llcommon/tests/llprocess_test.cpp
+++ b/indra/llcommon/tests/llprocess_test.cpp
@@ -30,6 +30,7 @@
#include "../test/namedtempfile.h"
#include "../test/catch_and_store_what_in.h"
#include "stringize.h"
+#include "lldir.h"
#include "llsdutil.h"
#include "llevents.h"
#include "llstring.h"
@@ -151,8 +152,37 @@ struct PythonProcessLauncher
/// Launch Python script; verify that it launched
void launch()
{
- mPy = LLProcess::create(mParams);
- tut::ensure(STRINGIZE("Couldn't launch " << mDesc << " script"), bool(mPy));
+ std::string logpath{ gDirUtilp->getExpandedFilename(LL_PATH_LOGS, "apr.log") };
+#if LL_WINDOWS
+ _putenv_s("APR_LOG", logpath.c_str());
+#else
+ setenv("APR_LOG", logpath.c_str(), 1);
+#endif
+ try
+ {
+ mPy = LLProcess::create(mParams);
+ tut::ensure(STRINGIZE("Couldn't launch " << mDesc << " script"), bool(mPy));
+ }
+ catch (const tut::failure& err);
+ {
+ std::ifstream inf(logpath.c_str());
+ if (! inf.is_open())
+ {
+ LL_WARNS() << "Couldn't open '" << logpath << "'" << LL_ENDL;
+ }
+ else
+ {
+ LL_WARNS() << "==============================" << LL_ENDL;
+ LL_WARNS() << "From '" << logpath << "':" << LL_ENDL;
+ std::string line;
+ while (std::getline(line, inf))
+ {
+ LL_WARNS() << line << LL_ENDL;
+ }
+ LL_WARNS() << "==============================" << LL_ENDL;
+ }
+ throw;
+ }
}
/// Run Python script and wait for it to complete.