From b1ba703f2ddb6707f5931faa88b4ad8a6c07a7e8 Mon Sep 17 00:00:00 2001 From: Bent Bisballe Nyeng Date: Sat, 28 Aug 2021 18:07:30 +0200 Subject: Call _exit if execv fails in child process. --- execute.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/execute.cc b/execute.cc index bb691cf..bc4cd5f 100644 --- a/execute.cc +++ b/execute.cc @@ -66,6 +66,9 @@ int execute(const std::string& command, if(pid == 0) { execv(command.data(), (char**)argv.data()); + std::cout << "Could not execute " << command << ": " << + strerror(errno) << "\n"; + _exit(1); // execv only returns if an error occurred } auto ret = parent_waitpid(pid); #elif 0 -- cgit v1.2.3