Skip to content

Commit

Permalink
Merge branch '2024-08-earnings-tracker-time-buckets' of github.com:ks…
Browse files Browse the repository at this point in the history
…edgwic/clboss into 2024-08-earnings-tracker-time-buckets
  • Loading branch information
ksedgwic committed Aug 8, 2024
2 parents 0482705 + f850706 commit f6725f4
Showing 1 changed file with 9 additions and 1 deletion.
10 changes: 9 additions & 1 deletion Util/BacktraceException.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,14 @@ namespace Util {
* deferred until `what()` is called on the handled exception.
*/

struct PcloseDeleter {
void operator()(FILE* fp) const {
if (fp) {
pclose(fp);
}
}
};

template <typename T>
class BacktraceException : public T {
public:
Expand Down Expand Up @@ -76,7 +84,7 @@ class BacktraceException : public T {

std::array<char, 128> buffer;
std::string result;
std::unique_ptr<FILE, decltype(&pclose)> pipe(popen(cmd, "r"), pclose);
std::unique_ptr<FILE, PcloseDeleter> pipe(popen(cmd, "r"));

if (!pipe) {
return " -- error: unable to open addr2line";
Expand Down

0 comments on commit f6725f4

Please sign in to comment.