From 840e906a4ddbbb32b8a5989e8a0ce10c8c374819 Mon Sep 17 00:00:00 2001 From: B Stack Date: Tue, 2 Mar 2021 17:23:41 -0500 Subject: add upstream 11.7 --- zen/process_exec.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) (limited to 'zen/process_exec.cpp') diff --git a/zen/process_exec.cpp b/zen/process_exec.cpp index bbc87c51..b82c2565 100644 --- a/zen/process_exec.cpp +++ b/zen/process_exec.cpp @@ -117,7 +117,7 @@ std::pair processExecuteImpl(const Zstring& file if (::dup(fdLifeSignW) == -1) //O_CLOEXEC does NOT propagate with dup() THROW_LAST_SYS_ERROR("dup(fdLifeSignW)"); - std::vector argv{ filePath.c_str() }; + std::vector argv{filePath.c_str()}; for (const Zstring& arg : arguments) argv.push_back(arg.c_str()); argv.push_back(nullptr); @@ -147,6 +147,8 @@ std::pair processExecuteImpl(const Zstring& file if (flags == -1) THROW_LAST_SYS_ERROR("fcntl(F_GETFL)"); + //fcntl() success: Linux: 0 + // macOS: "Value other than -1." if (::fcntl(fdLifeSignR, F_SETFL, flags | O_NONBLOCK) == -1) THROW_LAST_SYS_ERROR("fcntl(F_SETFL, O_NONBLOCK)"); @@ -174,7 +176,7 @@ std::pair processExecuteImpl(const Zstring& file const auto waitTimeMs = std::chrono::duration_cast(endTime - now).count(); - struct ::timeval tv = {}; + timeval tv = {}; tv.tv_sec = static_cast(waitTimeMs / 1000); tv.tv_usec = static_cast(waitTimeMs - tv.tv_sec * 1000) * 1000; @@ -219,7 +221,7 @@ std::pair processExecuteImpl(const Zstring& file exitCode == 127) //details should have been streamed to STDERR: used by /bin/sh, e.g. failure to execute due to missing .so file throw SysError(utfTo(trimCpy(output))); - return { exitCode, output }; + return {exitCode, output}; } } -- cgit