History

Don't display crash message if running from command line with a test script.

NissimHadar committed 8 years ago

Commit 46f461d1 parent 8b3c4511 file · +20 −4Browse files

Showing the changes to interface/src/Application.cpp (1 of 1 file). Show all

Unified · Split

interface/src/Application.cpp+20−4
@@ -743,6 +743,9 @@ extern DisplayPluginList getDisplayPlugins(); · 742 unmodified lines
743743 extern InputPluginList getInputPlugins();
744744 extern void saveInputPluginSettings(const InputPluginList& plugins);
745745
746+const QString TEST_SCRIPT { "--testScript" };
747+const QString TEST_SNAPSHOT_LOCATION { "--testSnapshotLocation" };
748+
746749 bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) {
747750 const char** constArgv = const_cast<const char**>(argv);
748751
@@ -777,7 +780,22 @@ bool setupEssentials(int& argc, char** argv, bool runningMarkerExisted) { · 28 unmodified lines
777780
778781 static const auto SUPPRESS_SETTINGS_RESET = "--suppress-settings-reset";
779782 bool suppressPrompt = cmdOptionExists(argc, const_cast<const char**>(argv), SUPPRESS_SETTINGS_RESET);
780− bool previousSessionCrashed = CrashHandler::checkForResetSettings(runningMarkerExisted, suppressPrompt);
783+
784+ // Ignore any previous crashes if running from command line with a test script.
785+ bool inTestMode { false };
786+ for (int i = 0; i < argc; ++i) {
787+ QString parameter(argv[i]);
788+ if (parameter == TEST_SCRIPT) {
789+ inTestMode = true;
790+ break;
791+ }
792+ }
793+
794+ bool previousSessionCrashed { false };
795+ if (!inTestMode) {
796+ previousSessionCrashed = CrashHandler::checkForResetSettings(runningMarkerExisted, suppressPrompt);
797+ }
798+
781799 // get dir to use for cache
782800 static const auto CACHE_SWITCH = "--cache";
783801 QString cacheDir = getCmdOption(argc, const_cast<const char**>(argv), CACHE_SWITCH);
@@ -997,10 +1015,8 @@ Application::Application(int& argc, char** argv, QElapsedTimer& startupTimer, bo · 213 unmodified lines
9971015 setProperty(hifi::properties::STEAM, (steamClient && steamClient->isRunning()));
9981016 setProperty(hifi::properties::CRASHED, _previousSessionCrashed);
9991017 {
1000− const QString TEST_SCRIPT { "--testScript" };
1001− const QString TEST_SNAPSHOT_LOCATION { "--testSnapshotLocation" };
1002−
10031018 const QStringList args = arguments();
1019+
10041020 for (int i = 0; i < args.size() - 1; ++i) {
10051021 if (args.at(i) == TEST_SCRIPT) {
10061022 QString testScriptPath = args.at(i + 1);