Skip to content

Commit

Permalink
Fix right trim
Browse files Browse the repository at this point in the history
  • Loading branch information
zcbenz committed Dec 21, 2024
1 parent 1906cbb commit 63e7267
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion mlx/backend/common/compiled_cpu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,13 @@ std::string exec(std::string cmd) {
ret += buffer;
}
// Trim trailing spaces.
ret.erase(std::remove_if(ret.begin(), ret.end(), isspace), ret.end());
ret.erase(
std::find_if(
ret.rbegin(),
ret.rend(),
[](unsigned char ch) { return !std::isspace(ch); })
.base(),
ret.end());
return ret;
}

Expand Down

0 comments on commit 63e7267

Please sign in to comment.