diff options
author | Matthias Maennich <maennich@google.com> | 2021-12-09 14:55:15 +0000 |
---|---|---|
committer | Matthias Männich <maennich@google.com> | 2021-12-09 16:30:23 +0000 |
commit | 65cc9ba16295f4f2c7f59015c1e7433c586d35f6 (patch) | |
tree | b526f9603de85fb1be5117b236f2b47d4d02b085 | |
parent | d11a88cb93cdad7d8508d600ff158163459a0a39 (diff) | |
download | interceptor-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.cc | 4 |
1 files changed, 3 insertions, 1 deletions
@@ -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); } |