Skip to content

Commit e46972d

Browse files
Ryan Hancockfacebook-github-bot
authored andcommitted
Add Exit Hooks to ToolHooks (facebook#13772)
Summary: This diff introduces the ability to override behavior of exits, allow for users to catch exits in a try catch for example as opposed to fully exiting the process. Pull Request resolved: facebook#13772 Reviewed By: hx235 Differential Revision: D78244499 Pulled By: krhancoc fbshipit-source-id: b403327ed5b494a22b6beeaad4083945a1def0c7
1 parent b09e27b commit e46972d

2 files changed

Lines changed: 80 additions & 64 deletions

File tree

include/rocksdb/tool_hooks.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@ class ToolHooks {
6969
virtual Status Open(const Options& options,
7070
const blob_db::BlobDBOptions& bdb_options,
7171
const std::string& dbname, blob_db::BlobDB** blob_db) = 0;
72+
virtual void Exit(int status) = 0;
7273
};
7374

7475
class DefaultHooks : public ToolHooks {
@@ -117,6 +118,8 @@ class DefaultHooks : public ToolHooks {
117118
const blob_db::BlobDBOptions& bdb_options,
118119
const std::string& dbname,
119120
blob_db::BlobDB** blob_db) override;
121+
122+
virtual void Exit(int status) override { exit(status); }
120123
};
121124

122125
extern DefaultHooks defaultHooks;

0 commit comments

Comments
 (0)