aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorStefan Boberg <[email protected]>2025-06-04 14:12:45 +0200
committerGitHub Enterprise <[email protected]>2025-06-04 14:12:45 +0200
commita584b6cbb5a3239488a38e7705c5443a77cf16ab (patch)
tree9ad970aca7715ee2cfc4ee7490636511d66f39f4 /src
parentbuilds download url (#419) (diff)
downloadzen-a584b6cbb5a3239488a38e7705c5443a77cf16ab.tar.xz
zen-a584b6cbb5a3239488a38e7705c5443a77cf16ab.zip
Initialize sentry after command line parsing is done (#420)
Previously the option variables were used before options parsing had a chance to set them according to command line options
Diffstat (limited to 'src')
-rw-r--r--src/zen/zen.cpp49
1 files changed, 25 insertions, 24 deletions
diff --git a/src/zen/zen.cpp b/src/zen/zen.cpp
index 53fdf3d36..2dc0fa98c 100644
--- a/src/zen/zen.cpp
+++ b/src/zen/zen.cpp
@@ -844,7 +844,6 @@ main(int argc, char** argv)
.add_option("ue-trace", "", "tracefile", "Path to write a trace to", cxxopts::value<std::string>(TraceFile)->default_value(""), "");
#endif // ZEN_WITH_TRACE
- Options.parse_positional({"command"});
#if ZEN_USE_SENTRY
bool NoSentry = false;
bool SentryAllowPII = false;
@@ -854,29 +853,7 @@ main(int argc, char** argv)
cxxopts::value<bool>(SentryAllowPII)->default_value("false"));
#endif
-#if ZEN_USE_SENTRY
- SentryIntegration Sentry;
-
- if (NoSentry == false)
- {
- std::string SentryDatabasePath = (GetRunningExecutablePath().parent_path() / ".sentry-native").string();
-
- ExtendableStringBuilder<512> SB;
- for (int i = 0; i < argc; ++i)
- {
- if (i)
- {
- SB.Append(' ');
- }
-
- SB.Append(argv[i]);
- }
-
- Sentry.Initialize(SentryDatabasePath, {}, SentryAllowPII, SB.ToString());
-
- SentryIntegration::ClearCaches();
- }
-#endif
+ Options.parse_positional({"command"});
const bool IsNullInvoke = (argc == 1); // If no arguments are passed we want to print usage information
@@ -917,6 +894,30 @@ main(int argc, char** argv)
exit(0);
}
+#if ZEN_USE_SENTRY
+ SentryIntegration Sentry;
+
+ if (NoSentry == false)
+ {
+ std::string SentryDatabasePath = (GetRunningExecutablePath().parent_path() / ".sentry-native").string();
+
+ ExtendableStringBuilder<512> SB;
+ for (int i = 0; i < argc; ++i)
+ {
+ if (i)
+ {
+ SB.Append(' ');
+ }
+
+ SB.Append(argv[i]);
+ }
+
+ Sentry.Initialize(SentryDatabasePath, {}, SentryAllowPII, SB.ToString());
+
+ SentryIntegration::ClearCaches();
+ }
+#endif
+
zen::LoggingOptions LogOptions;
LogOptions.IsDebug = GlobalOptions.IsDebug;
LogOptions.IsVerbose = GlobalOptions.IsVerbose;