summaryrefslogtreecommitdiff
path: root/src/execute.cc
diff options
context:
space:
mode:
Diffstat (limited to 'src/execute.cc')
-rw-r--r--src/execute.cc13
1 files changed, 8 insertions, 5 deletions
diff --git a/src/execute.cc b/src/execute.cc
index b4013d0..cbae899 100644
--- a/src/execute.cc
+++ b/src/execute.cc
@@ -3,6 +3,8 @@
// See accompanying file LICENSE for details.
#include "execute.h"
+#include "ctor.h"
+
#include <unistd.h>
#include <cstring>
#include <sys/types.h>
@@ -44,7 +46,7 @@ public:
int parent_waitpid(pid_t pid)
{
- int status;
+ int status{};
if(waitpid(pid, &status, 0) != pid)
{
@@ -57,10 +59,11 @@ int parent_waitpid(pid_t pid)
extern char **environ; // see 'man environ'
-int execute(const std::string& command,
+int execute(const ctor::settings& settings,
+ const std::string& command,
const std::vector<std::string>& args,
const std::map<std::string, std::string>& env,
- bool verbose)
+ [[maybe_unused]] bool terminate)
{
std::vector<const char*> argv;
argv.push_back(command.data());
@@ -84,7 +87,7 @@ int execute(const std::string& command,
cmd += arg;
}
- if(verbose)
+ if(settings.verbose)
{
std::cout << cmd << std::endl;
}
@@ -101,7 +104,7 @@ int execute(const std::string& command,
for(auto current = environ; *current; ++current)
{
- venv.push_back(*current);
+ venv.emplace_back(*current);
}
Env penv(venv);