From 5232d33f6ed486d413eadfe11b6567650a7d6362 Mon Sep 17 00:00:00 2001 From: "dmytro.bogovych" Date: Fri, 1 Feb 2019 17:30:19 +0300 Subject: [PATCH] - new OsProcess::execSystem() method --- src/engine/helper/HL_Process.cpp | 7 ++++++- src/engine/helper/HL_Process.h | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/engine/helper/HL_Process.cpp b/src/engine/helper/HL_Process.cpp index c573746e..363245e8 100644 --- a/src/engine/helper/HL_Process.cpp +++ b/src/engine/helper/HL_Process.cpp @@ -212,6 +212,11 @@ std::string OsProcess::execCommand(const std::string& cmd) return result; } +int OsProcess::execSystem(const std::string& cmd) +{ + return system(cmd.c_str()); +} + #include #include #include @@ -321,7 +326,7 @@ void OsProcess::killByPid(pid_t pid) { if (pid <= 0) return; - execCommand("kill -9 " + std::to_string(pid)); + execSystem("kill " + std::to_string(pid)); } #endif diff --git a/src/engine/helper/HL_Process.h b/src/engine/helper/HL_Process.h index 2f596ae4..e933198d 100644 --- a/src/engine/helper/HL_Process.h +++ b/src/engine/helper/HL_Process.h @@ -10,6 +10,7 @@ class OsProcess { public: static std::string execCommand(const std::string& cmdline); + static int execSystem(const std::string& cmdline); static std::shared_ptr asyncExecCommand(const std::string& cmdline, std::function line_callback, std::function finished_callback,