refactor: prefer spdlog

This commit is contained in:
Alex 2020-05-24 22:14:17 +02:00
parent eb624c929d
commit 1d92d78de7
1 changed files with 6 additions and 6 deletions

View File

@ -38,13 +38,13 @@ inline int close(FILE* fp, pid_t pid) {
waitpid(pid, &stat, WCONTINUED | WUNTRACED); waitpid(pid, &stat, WCONTINUED | WUNTRACED);
if (WIFEXITED(stat)) { if (WIFEXITED(stat)) {
spdlog::debug("{} exited with code {}", WEXITSTATUS(stat)); spdlog::debug("Cmd exited with code {}", WEXITSTATUS(stat));
} else if (WIFSIGNALED(stat)) { } else if (WIFSIGNALED(stat)) {
spdlog::debug("{} killed by {}", WTERMSIG(stat)); spdlog::debug("Cmd killed by {}", WTERMSIG(stat));
} else if (WIFSTOPPED(stat)) { } else if (WIFSTOPPED(stat)) {
spdlog::debug("{} stopped by {}", WSTOPSIG(stat)); spdlog::debug("Cmd stopped by {}", WSTOPSIG(stat));
} else if (WIFCONTINUED(stat)) { } else if (WIFCONTINUED(stat)) {
spdlog::debug("{} continued"); spdlog::debug("Cmd continued");
} else { } else {
break; break;
} }
@ -60,7 +60,7 @@ inline FILE* open(const std::string& cmd, int& pid) {
pid_t child_pid = fork(); pid_t child_pid = fork();
if (child_pid < 0) { if (child_pid < 0) {
printf("Unable to exec cmd %s, error %s", cmd.c_str(), strerror(errno)); spdlog::error("Unable to exec cmd {}, error {}", cmd.c_str(), strerror(errno));
return nullptr; return nullptr;
} }
@ -100,7 +100,7 @@ inline int32_t forkExec(const std::string& cmd) {
int32_t pid = fork(); int32_t pid = fork();
if (pid < 0) { if (pid < 0) {
printf("Unable to exec cmd %s, error %s", cmd.c_str(), strerror(errno)); spdlog::error("Unable to exec cmd {}, error {}", cmd.c_str(), strerror(errno));
return pid; return pid;
} }