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
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 @@
 
   // 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);
 }