summaryrefslogtreecommitdiff
path: root/indra/llcommon
AgeCommit message (Collapse)Author
2012-02-12Automated merge with ssh://hg.lindenlab.com/nat/viewer-new-aprNat Goodspeed
2012-02-09Remove LLJob class: apr_procattr_autokill_set() should now handle.Nat Goodspeed
LLJob was vestigial code from before migrating Job Object support into APR. Also add APR signal-name string to getStatusString() output.
2012-02-07Use os.path.normcase(os.path.normpath()) when comparing directories.Nat Goodspeed
Once again we've been bitten by comparison failure between "c:\somepath" and "C:\somepath". Normalize paths in both Python helper scripts to make that comparison more robust.
2012-02-07On Linux, #undef Status: we use that name for nested LLProcess struct.Nat Goodspeed
Apparently something in the Linux system header chain #defines a macro Status as 'int'. That's just Bad in C++ land. It should at the very least be a typedef! #undefining it in llprocess.h permits the viewer to build.
2012-02-07LLProcess::Status enum values need qualification in helper function.Nat Goodspeed
2012-02-07Convert LLProcess implementation from platform-specific to using APR.Nat Goodspeed
Include logic to engage Linden apr_procattr_autokill_set() extension: on Windows, magic CreateProcess() flag must be pushed down into apr_proc_create() level. When using an APR package without that extension, present implementation should lock (e.g.) SLVoice.exe lifespan to viewer's on Windows XP but probably won't on Windows 7: need magic flag on CreateProcess(). Using APR child-termination callback requires us to define state (e.g. LLProcess::RUNNING). Take the opportunity to present Status, capturing state and (if terminated) rc or signal number; but since most of the time all caller really wants is to log the outcome, also present status string, encapsulating logic to examine state and describe exited-with-rc vs. killed-by-signal. New Status logic may report clearer results in the case of a Windows child process killed by exception. Clarify that static LLProcess::isRunning(handle) overload is only for use when the original LLProcess object has been destroyed: really only for unit tests. We necessarily retain our original platform-specific implementations for just that one method. (Nonstatic isRunning() no longer calls static method.) Clarify log output from llprocess_test.cpp in a couple places.
2012-02-06increment viewer version to 3.3.0Oz Linden
2012-01-30Set bit flag on CreateProcess() to allow AssignProcessToJobObject().Nat Goodspeed
Windows 7 and friends tend to create a process already implicitly allocated to a job object, and a process can only belong to a single job object. Passing CREATE_BREAKAWAY_FROM_JOB in CreateProcessA()'s dwCreationFlags seems to bypass the access-denied error observed with AssignProcessToJobObject() otherwise. This change should (!) enable OS lifespan management for SLVoice.exe et al.
2012-01-30increment viewer version to 3.2.9Oz Linden
2012-01-30LLProcess::handle must be qualified when used in LLJob class.Nat Goodspeed
2012-01-30Expose 'handle' as well as 'id' on LLProcess objects.Nat Goodspeed
On Posix, these and the corresponding getProcessID()/getProcessHandle() accessors produce the same pid_t value; but on Windows, it's useful to distinguish an int-like 'id' useful to human log readers versus an opaque 'handle' for passing to platform-specific API functions. So make the distinction in a platform-independent way.
2012-01-30Trim trailing "\r\n" from Windows FormatMessage() string for logging.Nat Goodspeed
2012-01-27On Windows, only quote LLProcess arguments if they seem to need it.Nat Goodspeed
On Posix platforms, the OS argument mechanism makes quoting/reparsing unnecessary anyway, so this only affects Windows. Add optional 'triggers' parameter to LLStringUtils::quote() (default: space and double-quote). Only if the passed string contains a character in 'triggers' will it be double-quoted. This is observed to fix a Windows-specific problem in which plugin child process would fail to start because it wasn't expecting a quoted number. Use LLStringUtils::quote() more consistently in LLProcess implementation for logging.
2012-01-24mergeBrad Payne (Vir Linden)
2012-01-23Clarify that items in LLProcess::Params::args are implicitly quoted.Nat Goodspeed
That is, we try to pass through each args entry as a separate child-process arvg[] entry, whitespace and all.
2012-01-23LLStringUtil methods are conventionally static.Nat Goodspeed
2012-01-23Per Richard: close unusable Job Object; move quote() to LLStringUtil.Nat Goodspeed
If LLProcess can't set the right flag on a Windows Job Object, the object isn't useful to us, so we might as well discard it. quote() is sufficiently general that it belongs in LLStringUtil instead of buried as a static helper function in llprocess.cpp.
2012-01-22Every singleton needs a friend...Nat Goodspeed
2012-01-22Add LLProcess logging on launch(), kill(), isRunning().Nat Goodspeed
Much as I dislike viewer log spam, seems to me starting a child process, killing it and observing its termination are noteworthy events. New logging makes LLExternalEditor launch message redundant; removed.
2012-01-22Make LLProcess::Params streamable; use that in LLExternalEditor.Nat Goodspeed
2012-01-22On Windows, introduce viewer Job Object and assign children to it.Nat Goodspeed
The idea is that, with the right flag settings, this will cause the OS to terminate remaining viewer child processes when the viewer terminates -- whether or not it terminates intentionally. Of course, if LLProcess's caller specifies autokill=false, e.g. to run the viewer updater, that asserts that we WANT the child to persist beyond the viewer session itself.
2012-01-21Convert LLProcess consumers from LLSD to LLProcess::Params block.Nat Goodspeed
Using a Params block gives compile-time checking against attribute typos. One might inadvertently set myLLSD["autofill"] = false and only discover it when things behave strangely at runtime; but trying to set myParams.autofill will produce a compile error. However, it's excellent that the same LLProcess::create() method can accept either LLProcess::Params or a properly-constructed LLSD block.
2012-01-20Define LLProcess::Params; accept create(const LLSDParamAdapter<Params>&).Nat Goodspeed
This allows callers to pass either LLSD formatted as before -- which all callers still do -- or an actual LLProcess::Params block.
2012-01-20Automated merge with http://hg.lindenlab.com/richard/viewer-initparam-llcommonNat Goodspeed
2012-01-20Per Richard, replace LLProcessLauncher with LLProcess.Nat Goodspeed
LLProcessLauncher had the somewhat fuzzy mandate of (1) accumulating parameters with which to launch a child process and (2) sometimes tracking the lifespan of the ensuing child process. But a valid LLProcessLauncher object might or might not have ever been associated with an actual child process. LLProcess specifically tracks a child process. In effect, it's a fairly thin wrapper around a process HANDLE (on Windows) or pid_t (elsewhere), with lifespan management thrown in. A static LLProcess::create() method launches a new child; create() accepts an LLSD bundle with child parameters. So building up a parameter bundle is deferred to LLSD rather than conflated with the process management object. Reconcile all known LLProcessLauncher consumers in the viewer code base, notably the class unit tests.
2012-01-20moved LLSDParam to llcommon so that LLSD<->Param Block conversion are usable ↵Richard Linden
by everyone
2012-01-20removed LLXUIXML libraryRichard Linden
moved LLInitParam, and LLRegistry to llcommon moved LLUIColor, LLTrans, and LLXUIParser to llui reviewed by Nat
2012-01-20fix for SH-2823 and SH-2824: LLCurl crash inside LLBufferArray::countAfter() ↵Xiaohong Bao
and LLBufferArray::copyIntoBuffers
2012-01-19To grow std::string by a char, use push_back() instead of append().Nat Goodspeed
2012-01-19Try to fix argument quoting on Windows.Nat Goodspeed
Despite LLProcessLauncher's list-of-argument-strings API, on Windows it must ram them all into a single command-line string anyway. This means that if arguments contain spaces (or anything else that would confuse Windows command- line parsing), the target process won't receive the intended arguments. Introduce double quotes for any arguments not already double-quoted by caller.
2012-01-18Make embedded Python scripts compatible with Python 2.5 *SIGH*Nat Goodspeed
Apparently our TeamCity build machines are still not up to Python 2.6.
2012-01-18Add tests for implicit-kill-on-destroy, also orphan() method.Nat Goodspeed
2012-01-18Introduce static LLProcessLauncher::isRunning(ll_pid_t) method.Nat Goodspeed
typedef LLProcessLauncher::ll_pid_t to be HANDLE on Windows, pid_t elsewhere. Then we can define getProcessID() returning ll_pid_t on all platforms, retaining getProcessHandle() for hypothetical existing consumers... of which there are none in practice. This lets us define isRunning(ll_pid_t) to encapsulate the platform-specific logic to actually check on a running child process, turning non-static isRunning() into a fairly trivial wrapper.
2012-01-17Add tests for child-process args management and for kill() method.Nat Goodspeed
2012-01-17Refactor llprocesslauncher_test.cpp for better code reuse.Nat Goodspeed
Instead of free python() and python_out() functions containing a local temporary LLProcessLauncher instance, with a 'tweak' callback param to "do stuff" to that inaccessible object, change to a PythonProcessLauncher class that sets up a (public) LLProcessLauncher member, then allows you to run() or run() and then readfile() the output. Now you can construct an instance and tweak to your heart's content -- without funky callback syntax -- before running the script. Move all such helpers from TUT fixture struct to namespace scope. While fixture-struct methods can freely call one another, introducing a nested class gets awkward: constructor must explicitly require and bind a fixture-struct pointer or reference. Namespace scope solves this. (Truthfully, I only put them in the fixture struct originally because I thought it necessary for calling ensure() et al. But ensure() and friends are free functions; need only qualify them with tut:: namespace.)
2012-01-17Add first couple of LLProcessLauncher tests.Nat Goodspeed
Run INTEGRATION_TEST_llprocesslauncher using setpython.py so we can find the Python interpreter of interest. Introduce python() function to run a Python script specified using NamedTempFile conventions. Introduce a convention by which we can read output from a Python script using only the limited pre-January-2012 LLProcessLauncher API. Introduce python_out() function to leverage that convention. Exercise a couple of LLProcessLauncher methods using all the above.
2012-01-17Add log message if LLProcessLauncher child fails to execv().Nat Goodspeed
On a Posix platform (vfork()/execv() implementation), if for any reason the execv() failed (e.g. executable not on PATH), the viewer would never know, nor the user: the vfork() child produced no output, and terminated with rc 0! Add logging, make child terminate with nonzero rc. Remove pointless addArgument(const char*) overload: this does nothing for you that the compiler won't do implicitly. In llupdateinstaller.cpp, remove pointless c_str() call in addArgument() arg: we were starting with a std::string, then extracting its c_str(), only to construct a whole new std::string from it!
2012-01-17increment viewer version to 3.2.8Oz Linden
2012-01-17merge changes for vmrg-216Oz Linden
2012-01-13Extract APR and temp-fixture-file helper code to indra/test.Nat Goodspeed
Specifically: Introduce ManageAPR class in indra/test/manageapr.h. This is useful for a simple test program without lots of static constructors. Extract NamedTempFile from llsdserialize_test.cpp to indra/test/ namedtempfile.h. Refactor to use APR file operations rather than platform- dependent APIs. Use NamedTempFile for llprocesslauncher_test.cpp.
2012-01-13merge changes for vmrg-215Oz Linden
2012-01-12Automated merge with https://bitbucket.org/lindenlab/viewer-developmentRichard Linden
2012-01-12Automated merge with ssh://hg.lindenlab.com/richard/viewer-experience/Richard Linden
2012-01-12Add LLStreamQueue::size() and tests to exercise it.Nat Goodspeed
2012-01-10EXP-1525 FIXED Potential fix for a crash at shutdown: added some error ↵Vadim ProductEngine
handling to saving inventory cache.
2012-01-09increment viewer version to 3.2.7Oz Linden
2012-01-09Backed out changeset 4fd359f2f1c3Oz Linden
2012-01-09increment viewer version to 3.2.7Oz Linden
2012-01-06Looking for better fix to EXP-1693 - date localizationRichard Linden
Backed out changeset: 4f3024e9d629
2012-01-05Introduce LLStreamQueue to buffer nonblocking I/O.Nat Goodspeed
Add unit tests to verify basic functionality.