diff options
-rw-r--r-- | indra/llcommon/llprocess.cpp | 14 | ||||
-rw-r--r-- | indra/llcommon/llprocess.h | 5 | ||||
-rw-r--r-- | indra/newview/llvoicevivox.cpp | 6 |
3 files changed, 23 insertions, 2 deletions
diff --git a/indra/llcommon/llprocess.cpp b/indra/llcommon/llprocess.cpp index 2208b33b94..cf19e3aae9 100644 --- a/indra/llcommon/llprocess.cpp +++ b/indra/llcommon/llprocess.cpp @@ -691,10 +691,22 @@ LLProcess::LLProcess(const LLSDOrParams& params): // terminate with a null pointer argv.push_back(NULL); + // create an env vector for the child process + std::vector<const char*> envv; + + // Add environment value assignments. See above remarks about c_str(). + for (const std::string& env : params.envs) + { + envv.push_back(env.c_str()); + } + + // terminate with a null pointer + envv.push_back(NULL); + // Launch! The NULL would be the environment block, if we were passing // one. Hand-expand chkapr() macro so we can fill in the actual command // string instead of the variable names. - if (ll_apr_warn_status(apr_proc_create(&mProcess, argv[0], &argv[0], NULL, procattr, + if (ll_apr_warn_status(apr_proc_create(&mProcess, argv[0], &argv[0], &envv[0], procattr, mPool))) { LLTHROW(LLProcessError(STRINGIZE(params << " failed"))); diff --git a/indra/llcommon/llprocess.h b/indra/llcommon/llprocess.h index dcd316cb0f..4e7451c4a1 100644 --- a/indra/llcommon/llprocess.h +++ b/indra/llcommon/llprocess.h @@ -165,6 +165,7 @@ public: Params(): executable("executable"), args("args"), + envs("envs"), cwd("cwd"), autokill("autokill", true), attached("attached", true), @@ -182,6 +183,10 @@ public: * argument while assembling the command line. */ Multiple<std::string> args; + /** + * zero or more additional command-line environment values. + */ + Multiple<std::string> envs; /// current working directory, if need it changed Optional<std::string> cwd; /// implicitly kill child process on termination of parent, whether diff --git a/indra/newview/llvoicevivox.cpp b/indra/newview/llvoicevivox.cpp index 4473c8b55b..cf5ee3af54 100644 --- a/indra/newview/llvoicevivox.cpp +++ b/indra/newview/llvoicevivox.cpp @@ -944,11 +944,15 @@ bool LLVivoxVoiceClient::startAndLaunchDaemon() // vivox executable exists. Build the command line and launch the daemon. LLProcess::Params params; #if LL_LINUX || __FreeBSD__ +#if __FreeBSD__ + params.envs.add("WINEARCH=win32"); + params.envs.add("WINEPREFIX=~/.i386-wine-pkg"); +#endif // __FreeBSD__ params.executable = "wine"; params.args.add(exe_path); #else params.executable = exe_path; -#endif +#endif // LL_LINUX || __FreeBSD__ // VOICE-88: Cycle through [portbase..portbase+portrange) on // successive tries because attempting to relaunch (after manually |