]> git.donarmstrong.com Git - mothur.git/blobdiff - getrabundcommand.cpp
added checks for ^C to quit command instead of program
[mothur.git] / getrabundcommand.cpp
index 5a192c5066d6f23921e356ed7a2785abbd967631..6b68c32cad7673b950eeb8acfe6423b160630130 100644 (file)
@@ -99,9 +99,7 @@ void GetRAbundCommand::help(){
 
 //**********************************************************************************************************************
 
-GetRAbundCommand::~GetRAbundCommand(){
-       if (abort == false) {  globaldata->gListVector = NULL; }
-}
+GetRAbundCommand::~GetRAbundCommand(){}
 
 //**********************************************************************************************************************
 
@@ -122,6 +120,8 @@ int GetRAbundCommand::execute(){
                set<string> processedLabels;
                set<string> userLabels = labels;
                
+               if (m->control_pressed) {  out.close(); remove(filename.c_str()); delete read; delete input; delete list; globaldata->gListVector = NULL;  return 0; }
+               
                while((list != NULL) && ((allLines == 1) || (userLabels.size() != 0))) {
                        
                        if(allLines == 1 || labels.count(list->getLabel()) == 1){
@@ -129,6 +129,9 @@ int GetRAbundCommand::execute(){
                                        rabund = new RAbundVector();                            
                                        *rabund = (list->getRAbundVector());
                                        
+                                       if (m->control_pressed) {  out.close(); remove(filename.c_str()); delete read; delete input; delete list; delete rabund; globaldata->gListVector = NULL;  return 0; }
+
+                                       
                                        if(sorted)      {   rabund->print(out);                         }
                                        else            {       rabund->nonSortedPrint(out);    }
                                        
@@ -148,6 +151,8 @@ int GetRAbundCommand::execute(){
                                        rabund = new RAbundVector();
                                        *rabund = (list->getRAbundVector());
                                        
+                                       if (m->control_pressed) {  out.close(); remove(filename.c_str()); delete read; delete input; delete list; delete rabund; globaldata->gListVector = NULL;  return 0; }
+                                       
                                        if(sorted)      {   rabund->print(out);                         }
                                        else            {       rabund->nonSortedPrint(out);    }
 
@@ -188,6 +193,8 @@ int GetRAbundCommand::execute(){
                        rabund = new RAbundVector();
                        *rabund = (list->getRAbundVector());
                        
+                       if (m->control_pressed) {  out.close(); remove(filename.c_str()); delete read; delete input; delete list; delete rabund; globaldata->gListVector = NULL;  return 0; }
+                       
                        if(sorted)      {   rabund->print(out);                         }
                        else            {       rabund->nonSortedPrint(out);    }
 
@@ -202,6 +209,9 @@ int GetRAbundCommand::execute(){
 
                
                out.close(); 
+               delete read; delete input;
+               globaldata->gListVector = NULL; 
+               
                return 0;               
        }