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 <noreply@anthropic.com>
This commit is contained in:
QDarkRex
2026-09-27 12:24:14 +07:00
parent 1a0ebbc849
commit f8485ce6a6
+4 -3
View File
@@ -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<std::streamsize>::max(), '\n');
std::cin.get();
return rawCode;
return exitCode;
}
}