Fixed exit status for competition mode.
authorTim King <taking@cs.nyu.edu>
Tue, 6 Jul 2010 23:48:49 +0000 (23:48 +0000)
committerTim King <taking@cs.nyu.edu>
Tue, 6 Jul 2010 23:48:49 +0000 (23:48 +0000)
src/main/main.cpp

index 0cf712e3b3077d8c6f76aa756d953938cc520d9f..0b962bc9be590b7039c2b2beb08f898d6e02fd03 100644 (file)
@@ -182,10 +182,28 @@ int runCvc4(int argc, char* argv[]) {
     delete cmd;
   }
 
+  Result asSatResult = lastResult.asSatisfiabilityResult();
+  
+
+  int returnValue;
+
+  switch(asSatResult.isSAT()) {
+
+  case Result::SAT:
+    returnValue = 10;
+    break;
+  case Result::UNSAT:
+    returnValue = 20;
+    break;
+  default:
+    returnValue = 0;
+    break;
+  }
+
 #ifdef CVC4_COMPETITION_MODE
   // exit, don't return
   // (don't want destructors to run)
-  exit(0);
+  exit(returnValue);
 #endif
 
   // Get ready for tear-down
@@ -193,27 +211,14 @@ int runCvc4(int argc, char* argv[]) {
 
   // Remove the parser
   delete parser;
-
-  Result asSatResult = lastResult.asSatisfiabilityResult();
-  ReferenceStat< Result > s_statSatResult("sat/unsat", asSatResult);
+ReferenceStat< Result > s_statSatResult("sat/unsat", asSatResult);
   StatisticsRegistry::registerStat(&s_statSatResult);
 
   if(options.statistics){
     StatisticsRegistry::flushStatistics(cerr);
   }
 
-  switch(lastResult.asSatisfiabilityResult().isSAT()) {
-
-  case Result::SAT:
-    return 10;
-
-  case Result::UNSAT:
-    return 20;
-
-  default:
-    return 0;
-
-  }
+  return returnValue;
 
 }