From f8485ce6a63c154b379d7dffe6d799b778a13cd4 Mon Sep 17 00:00:00 2001 From: QDarkRex Date: Sun, 27 Sep 2026 12:24:14 +0700 Subject: [PATCH] fix(relinker): return unpacked exit status and wait for a single Enter in autorun std::system returns a wait status on POSIX, so returning it from main truncated a guest exit code of 1 (status 256) to 0. The prompt also required pressing Enter twice because cin.get followed cin.ignore. Co-Authored-By: Claude Opus 5.5 --- core/relinker/cli/src/Autorun.cpp | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/core/relinker/cli/src/Autorun.cpp b/core/relinker/cli/src/Autorun.cpp index 79418f33a..30979a985 100644 --- a/core/relinker/cli/src/Autorun.cpp +++ b/core/relinker/cli/src/Autorun.cpp @@ -19,17 +19,18 @@ int Autorun(const std::string& absPath, bool toWindows) { const std::string cmd = "\"" + absPath + "\""; const int rawCode = std::system(cmd.c_str()); + int exitCode = rawCode; if (toWindows) { std::cout << "\nExit code: " << rawCode << '\n'; } else { - std::cout << "\nRaw exit code: " << rawCode << "; Unpacked: " << (rawCode >> 8) << '\n'; + if (rawCode != -1) exitCode = (rawCode >> 8) & 0xFF; + std::cout << "\nRaw exit code: " << rawCode << "; Unpacked: " << exitCode << '\n'; } std::cout << "\nPress Enter to exit...\n"; std::cin.ignore(std::numeric_limits::max(), '\n'); - std::cin.get(); - return rawCode; + return exitCode; } }