From 37cd63a356dce469e43554cceefdf935af794461 Mon Sep 17 00:00:00 2001 From: TheDoctor314 Date: Wed, 29 Sep 2021 00:36:40 +0530 Subject: [PATCH] Add env parameter in command::exec() --- include/utils/command.hpp | 2 +- src/utils/command.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/include/utils/command.hpp b/include/utils/command.hpp index 60a28601..956e885d 100644 --- a/include/utils/command.hpp +++ b/include/utils/command.hpp @@ -88,7 +88,7 @@ class command : private command>& env = {}); using command::terminate; using command::is_running; using command::wait; diff --git a/src/utils/command.cpp b/src/utils/command.cpp index 7e8d3a9f..fa234788 100644 --- a/src/utils/command.cpp +++ b/src/utils/command.cpp @@ -128,7 +128,7 @@ command::~command() { /** * Execute the command */ -int command::exec(bool wait_for_completion) { +int command::exec(bool wait_for_completion, const vector>& env) { if ((m_forkpid = fork()) == -1) { throw system_error("Failed to fork process"); } @@ -159,7 +159,7 @@ int command::exec(bool wait_for_completion) { } setpgid(m_forkpid, 0); - process_util::exec_sh(m_cmd.c_str()); + process_util::exec_sh(m_cmd.c_str(), env); } else { // Close file descriptors that won't be used by the parent if ((m_stdin[PIPE_READ] = close(m_stdin[PIPE_READ])) == -1) {