aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMatthias Maennich <maennich@google.com>2021-12-09 14:55:15 +0000
committerMatthias Männich <maennich@google.com>2021-12-09 16:30:23 +0000
commit65cc9ba16295f4f2c7f59015c1e7433c586d35f6 (patch)
treeb526f9603de85fb1be5117b236f2b47d4d02b085
parentd11a88cb93cdad7d8508d600ff158163459a0a39 (diff)
downloadinterceptor-65cc9ba16295f4f2c7f59015c1e7433c586d35f6.tar.gz
main: ensure the correct return code is emitted
std::system's return value needs additional treatment to make it the expected return value resembling what the wrapped process returned. Signed-off-by: Matthias Maennich <maennich@google.com> Change-Id: Ib335a383ce07d0311df1b3f6ba8e7addd26360ee
-rw-r--r--main.cc4
1 files changed, 3 insertions, 1 deletions
diff --git a/main.cc b/main.cc
index dce5abb..5223d4b 100644
--- a/main.cc
+++ b/main.cc
@@ -16,6 +16,7 @@
#include <getopt.h>
#include <stdlib.h>
+#include <sys/wait.h>
#include <sysexits.h>
#include <cstdlib>
#include <filesystem>
@@ -188,5 +189,6 @@ int main(int argc, char* argv[]) {
// TODO: cleanly to google::protobuf::ShutdownProtobufLibrary();
- return std::system(options.command_line.c_str());
+ auto status = std::system(options.command_line.c_str());
+ return WEXITSTATUS(status);
}