瀏覽代碼

Nicer error message if the executable does not exist

default_compile_flags
vector-of-bool 5 年之前
父節點
當前提交
3dca5c4560
共有 1 個檔案被更改,包括 7 行新增0 行删除
  1. +7
    -0
      src/dds/proc.nix.cpp

+ 7
- 0
src/dds/proc.nix.cpp 查看文件

@@ -1,6 +1,8 @@
#ifndef _WIN32
#include "./proc.hpp"

#include <spdlog/fmt/fmt.h>

#include <poll.h>
#include <sys/wait.h>
#include <unistd.h>
@@ -42,6 +44,11 @@ spawn_child(const std::vector<std::string>& command, int stdout_pipe, int close_
strings.push_back(nullptr);
::execvp(strings[0], (char* const*)strings.data());

if (errno == ENOENT) {
std::cerr << fmt::format("[ddslim child executor] The requested executable ({}) could not be found.", strings[0]);
std::exit(-1);
}

std::cerr << "[ddslim child executor] execvp returned! This is a fatal error: "
<< std::system_category().message(errno) << '\n';


Loading…
取消
儲存