Skip to content

Commit

Permalink
Remove non-determinism in output when traversing directories (#120)
Browse files Browse the repository at this point in the history
Signed-off-by: Juan Cruz Viotti <[email protected]>
  • Loading branch information
jviotti authored Jul 12, 2024
1 parent adb6fa2 commit 00a94bc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/utils.cc
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@

#include "utils.h"

#include <algorithm> // std::any_of, std::none_of
#include <algorithm> // std::any_of, std::none_of, std::sort
#include <cassert> // assert
#include <fstream> // std::ofstream
#include <iostream> // std::cerr
Expand Down Expand Up @@ -121,6 +121,9 @@ auto for_each_json(const std::vector<std::string> &arguments,
}
}

std::sort(result.begin(), result.end(),
[](const auto &left, const auto &right) { return left < right; });

return result;
}

Expand Down

0 comments on commit 00a94bc

Please sign in to comment.