Skip to content

Commit 9ff6e10

Browse files
committed
FileFetcher: set locale if not set, since boost requires it
1 parent 7c80b52 commit 9ff6e10

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

Common/Utils/src/FileFetcher.cxx

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,8 @@
2020
#include <memory>
2121
#include <thread>
2222
#include <chrono>
23+
#include <cstdlib>
24+
#include <locale>
2325
#include <boost/process.hpp>
2426

2527
using namespace o2::utils;
@@ -233,6 +235,20 @@ void FileFetcher::fetcher()
233235
return;
234236
}
235237

238+
// BOOST requires a locale set
239+
try {
240+
std::locale loc("");
241+
} catch (const std::exception& e) {
242+
setenv("LC_ALL", "C", 1);
243+
try {
244+
std::locale loc("");
245+
LOG(INFO) << "Setting locale";
246+
} catch (const std::exception& e) {
247+
LOG(INFO) << "Setting locale failed: " << e.what();
248+
return;
249+
}
250+
}
251+
236252
while (mRunning) {
237253
mNLoops = mNFilesProc / getNFiles();
238254
if (mNLoops > mMaxLoops) {

0 commit comments

Comments
 (0)