From 317de9cfcdd03c59a937cd8e5d50bb3df55ded72 Mon Sep 17 00:00:00 2001 From: "mergify[bot]" <37929162+mergify[bot]@users.noreply.github.com> Date: Fri, 3 Jan 2025 15:04:33 +0000 Subject: [PATCH] Ignore sigpipe to prevent SIGPIPE in CloudSQLite which crashes the process (#944) (#949) * ignore sigpipe: no idea if this is the appropriate place to do it * update comment (cherry picked from commit 3574f5b35a4a50c390a3dbc4368b112bda14a6ec) Co-authored-by: Nick Tessier <22119573+nick4598@users.noreply.github.com> --- iModelJsNodeAddon/IModelJsNative.h | 3 +++ iModelJsNodeAddon/JsCloudSqlite.cpp | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/iModelJsNodeAddon/IModelJsNative.h b/iModelJsNodeAddon/IModelJsNative.h index 571a4a9b6a..6f333c9371 100644 --- a/iModelJsNodeAddon/IModelJsNative.h +++ b/iModelJsNodeAddon/IModelJsNative.h @@ -15,6 +15,9 @@ #include #include #include "DgnDbWorker.h" +#ifndef BENTLEY_WIN32 + #include +#endif USING_NAMESPACE_BENTLEY USING_NAMESPACE_BENTLEY_SQLITE diff --git a/iModelJsNodeAddon/JsCloudSqlite.cpp b/iModelJsNodeAddon/JsCloudSqlite.cpp index 6391479c61..59baccf370 100644 --- a/iModelJsNodeAddon/JsCloudSqlite.cpp +++ b/iModelJsNodeAddon/JsCloudSqlite.cpp @@ -1032,6 +1032,10 @@ void registerCloudSqlite(Napi::Env env, Napi::Object exports) { JsCloudCache::Init(env, exports); JsCloudContainer::Init(env, exports); JsCloudPrefetch::Init(env, exports); + #ifndef BENTLEY_WIN32 + // Ignore SIGPIPE to prevent crashes in CloudSQLite/curl. + signal(SIGPIPE, SIG_IGN); + #endif } } // end namespace IModelJsNative \ No newline at end of file