- new OsProcess::execSystem() method
This commit is contained in:
@@ -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 <poll.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/uio.h>
|
||||
@@ -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
|
||||
|
||||
@@ -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<std::thread> asyncExecCommand(const std::string& cmdline,
|
||||
std::function<void(const std::string& line)> line_callback,
|
||||
std::function<void(const std::string& reason)> finished_callback,
|
||||
|
||||
Reference in New Issue
Block a user