Pass the environment as a const reference so nobody else is tempted to modify it

This commit is contained in:
Cameron Gutman 2023-08-14 19:36:02 -05:00
parent 774f13aecb
commit 22ab9948fa
4 changed files with 4 additions and 4 deletions

View File

@ -547,7 +547,7 @@ namespace platf {
display_names(mem_type_e hwdevice_type);
boost::process::child
run_command(bool elevated, bool interactive, const std::string &cmd, boost::filesystem::path &working_dir, boost::process::environment &env, FILE *file, std::error_code &ec, boost::process::group *group);
run_command(bool elevated, bool interactive, const std::string &cmd, boost::filesystem::path &working_dir, const boost::process::environment &env, FILE *file, std::error_code &ec, boost::process::group *group);
enum class thread_priority_e : int {
low,

View File

@ -157,7 +157,7 @@ namespace platf {
}
bp::child
run_command(bool elevated, bool interactive, const std::string &cmd, boost::filesystem::path &working_dir, bp::environment &env, FILE *file, std::error_code &ec, bp::group *group) {
run_command(bool elevated, bool interactive, const std::string &cmd, boost::filesystem::path &working_dir, const bp::environment &env, FILE *file, std::error_code &ec, bp::group *group) {
if (!group) {
if (!file) {
return bp::child(cmd, env, bp::start_dir(working_dir), bp::std_out > bp::null, bp::std_err > bp::null, ec);

View File

@ -161,7 +161,7 @@ namespace platf {
}
bp::child
run_command(bool elevated, bool interactive, const std::string &cmd, boost::filesystem::path &working_dir, bp::environment &env, FILE *file, std::error_code &ec, bp::group *group) {
run_command(bool elevated, bool interactive, const std::string &cmd, boost::filesystem::path &working_dir, const bp::environment &env, FILE *file, std::error_code &ec, bp::group *group) {
if (!group) {
if (!file) {
return bp::child(cmd, env, bp::start_dir(working_dir), bp::std_out > bp::null, bp::std_err > bp::null, ec);

View File

@ -565,7 +565,7 @@ namespace platf {
* @return A `bp::child` object representing the new process, or an empty `bp::child` object if the launch fails.
*/
bp::child
run_command(bool elevated, bool interactive, const std::string &cmd, boost::filesystem::path &working_dir, bp::environment &env, FILE *file, std::error_code &ec, bp::group *group) {
run_command(bool elevated, bool interactive, const std::string &cmd, boost::filesystem::path &working_dir, const bp::environment &env, FILE *file, std::error_code &ec, bp::group *group) {
BOOL ret;
// Convert cmd, env, and working_dir to the appropriate character sets for Win32 APIs
std::wstring wcmd = converter.from_bytes(cmd);