Commits

Scott Lawrence committed d054734 Merge

Automated merge with ssh://hg@bitbucket.org/lindenlab/viewer-development

Comments (0)

Files changed (2)

 f1827b441e05bf37c68e2c15ebc6d09e9b03f527 2.6.0-start
 f1827b441e05bf37c68e2c15ebc6d09e9b03f527 2.6.0-start
 4e9eec6a347f89b2b3f295beb72f1cf7837dff66 2.6.0-start
+9283d6d1d7eb71dfe4c330e7c9144857e7356bde 2.6.0-beta1
+9283d6d1d7eb71dfe4c330e7c9144857e7356bde DRTVWR-40_2.6.0-beta1

indra/llcommon/llprocesslauncher.cpp

 	char *args2 = new char[args.size() + 1];
 	strcpy(args2, args.c_str());
 
-	if( ! CreateProcessA( NULL, args2, NULL, NULL, FALSE, 0, NULL, mWorkingDir.c_str(), &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.