Skip to content

Commit

Permalink
call WEXITSTATUS macro on return value of std::system() (must be used…
Browse files Browse the repository at this point in the history
… on POSIX systems since the actual return value is stored in upper 8 bits)
  • Loading branch information
nam20485 committed May 3, 2024
1 parent 51dd0cc commit 0539d5b
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions Utils/ArchiveExtractor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
#include <exception>
#include "macros.h"
#include "str_utils.h"
#include <cstdlib>
#include <stdexcept>

using namespace std::filesystem;

Expand Down Expand Up @@ -87,6 +89,11 @@ namespace Utils
loginfo("running 7z command: [" + command + "]...");

auto exitCode = std::system(command.c_str());

#ifdef __linux__ || __apple__
exitCode = WEXITSTATUS(exitCode);
#endif

if (exitCode != (int) e7zExitCode::Success &&
exitCode != (int) e7zExitCode::Warning)
{
Expand Down

0 comments on commit 0539d5b

Please sign in to comment.