Commit f8c901f5 authored by Aaryaman Sagar's avatar Aaryaman Sagar Committed by Facebook GitHub Bot

Add options to disable gflags to folly::InitOptions

Summary:
As title.  CLI applications that don't use gflags might not care about
process-wide gflags, so add an option to kill it.

Reviewed By: yfeldblum

Differential Revision: D27066900

fbshipit-source-id: d412391879cd5ac89eba5903fd033775cf0ca49a
parent 31477657
......@@ -65,7 +65,9 @@ void init(int* argc, char*** argv, InitOptions options) {
#if !FOLLY_HAVE_LIBGFLAGS
(void)options;
#else
gflags::ParseCommandLineFlags(argc, argv, options.remove_flags);
if (options.use_gflags) {
gflags::ParseCommandLineFlags(argc, argv, options.remove_flags);
}
#endif
folly::initLoggingOrDie(FLAGS_logging);
......
......@@ -25,6 +25,7 @@ class InitOptions {
InitOptions() noexcept;
bool remove_flags{true};
bool use_gflags{true};
// mask of all fatal (default handler of terminating the process) signals for
// which `init()` will install handler that print stack traces and invokes
......@@ -43,6 +44,11 @@ class InitOptions {
fatal_signals = val;
return *this;
}
InitOptions& useGFlags(bool useGFlags) {
use_gflags = useGFlags;
return *this;
}
};
/*
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment