refacor media widget, apply clang format rule
This commit is contained in:
@@ -1,17 +1,17 @@
|
||||
#pragma once
|
||||
|
||||
#include <array>
|
||||
#include <cstdio>
|
||||
#include <memory>
|
||||
#include <stdexcept>
|
||||
#include <string>
|
||||
#include <cstdio>
|
||||
|
||||
class CommandHelper {
|
||||
public:
|
||||
static std::string exec(const char *cmd) {
|
||||
std::array<char, 128> buffer;
|
||||
std::string result;
|
||||
std::unique_ptr<FILE, int(*)(FILE*)> pipe(popen(cmd, "r"), pclose);
|
||||
std::unique_ptr<FILE, int (*)(FILE *)> pipe(popen(cmd, "r"), pclose);
|
||||
if (!pipe) {
|
||||
throw std::runtime_error("popen() failed!");
|
||||
}
|
||||
@@ -23,7 +23,7 @@ class CommandHelper {
|
||||
|
||||
static void execNoOutput(std::string cmd) {
|
||||
std::string command = cmd + " > /dev/null 2>&1";
|
||||
int ret = std::system(command.c_str());
|
||||
int ret = std::system(command.c_str());
|
||||
if (ret != 0) {
|
||||
throw std::runtime_error("Command failed with return code: " + std::to_string(ret));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user