diff options
author | Oz Linden <oz@lindenlab.com> | 2011-03-29 19:19:24 -0400 |
---|---|---|
committer | Oz Linden <oz@lindenlab.com> | 2011-03-29 19:19:24 -0400 |
commit | 9c0757511ec4ed12b47c6d3fd2ef20fca6828a6e (patch) | |
tree | f1e08f8c3ade8afc4c83a1574c0d54ac6c224ed1 /indra/llcommon/llprocesslauncher.cpp | |
parent | 32012f9fd4e9a5cb37f3a91d79873b79b9e6531e (diff) | |
parent | 6faf2f8ee101162fdb1fe5959204055c9885968f (diff) |
merge changes for storm-1077
Diffstat (limited to 'indra/llcommon/llprocesslauncher.cpp')
-rw-r--r-- | indra/llcommon/llprocesslauncher.cpp | 24 |
1 files changed, 22 insertions, 2 deletions
diff --git a/indra/llcommon/llprocesslauncher.cpp b/indra/llcommon/llprocesslauncher.cpp index 4b0f6b0251..10950181fd 100644 --- a/indra/llcommon/llprocesslauncher.cpp +++ b/indra/llcommon/llprocesslauncher.cpp @@ -103,10 +103,30 @@ int LLProcessLauncher::launch(void) char *args2 = new char[args.size() + 1]; strcpy(args2, args.c_str()); - if( ! CreateProcessA( NULL, args2, NULL, NULL, FALSE, 0, NULL, NULL, &sinfo, &pinfo ) ) + const char * working_directory = 0; + if(!mWorkingDir.empty()) working_directory = mWorkingDir.c_str(); + if( ! CreateProcessA( NULL, args2, NULL, NULL, FALSE, 0, NULL, working_directory, &sinfo, &pinfo ) ) { - // TODO: do better than returning the OS-specific error code on failure... result = GetLastError(); + + LPTSTR error_str = 0; + if( + FormatMessage( FORMAT_MESSAGE_ALLOCATE_BUFFER | FORMAT_MESSAGE_FROM_SYSTEM, + NULL, + result, + 0, + (LPTSTR)&error_str, + 0, + NULL) + != 0) + { + char message[256]; + wcstombs(message, error_str, 256); + message[255] = 0; + llwarns << "CreateProcessA failed: " << message << llendl; + LocalFree(error_str); + } + if(result == 0) { // Make absolutely certain we return a non-zero value on failure. |