Skip to content

[wasm-reduce] Get the return code from pclose #7624

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 1 addition & 6 deletions src/tools/wasm-reduce.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -185,11 +185,6 @@ struct ProgramResult {
void getFromExecution(std::string command) {
Timer timer;
timer.start();
// do this using just core stdio.h and stdlib.h, for portability
// sadly this requires two invokes
code = system(("timeout " + std::to_string(timeout) + "s " + command +
" > /dev/null 2> /dev/null")
.c_str());
const int MAX_BUFFER = 1024;
char buffer[MAX_BUFFER];
FILE* stream = popen(
Expand All @@ -199,7 +194,7 @@ struct ProgramResult {
while (fgets(buffer, MAX_BUFFER, stream) != NULL) {
output.append(buffer);
}
pclose(stream);
code = pclose(stream);
timer.stop();
time = timer.getTotal() / 2;
}
Expand Down
Loading