]> git.donarmstrong.com Git - mothur.git/blobdiff - chimerapintailcommand.cpp
added [ERROR] flag if command aborts
[mothur.git] / chimerapintailcommand.cpp
index b355f6da6ac5839a054d4503e4dbb4f43237c23a..a8d2d65c6c3752fcc7ca9737e505c32850d62f7b 100644 (file)
@@ -25,6 +25,7 @@ vector<string> ChimeraPintailCommand::getValidParameters(){
 //**********************************************************************************************************************
 ChimeraPintailCommand::ChimeraPintailCommand(){        
        try {
+               abort = true; calledHelp = true;
                vector<string> tempOutNames;
                outputTypes["chimera"] = tempOutNames;
                outputTypes["accnos"] = tempOutNames;
@@ -60,10 +61,10 @@ vector<string> ChimeraPintailCommand::getRequiredFiles(){
 //***************************************************************************************************************
 ChimeraPintailCommand::ChimeraPintailCommand(string option)  {
        try {
-               abort = false;
+               abort = false; calledHelp = false;   
                
                //allow user to run help
-               if(option == "help") { help(); abort = true; }
+               if(option == "help") { help(); abort = true; calledHelp = true; }
                
                else {
                        //valid paramters for this command
@@ -309,7 +310,7 @@ ChimeraPintailCommand::~ChimeraPintailCommand(){    /*      do nothing      */      }
 int ChimeraPintailCommand::execute(){
        try{
                
-               if (abort == true) { return 0; }
+               if (abort == true) { if (calledHelp) { return 0; }  return 2;   }
                
                for (int s = 0; s < fastaFileNames.size(); s++) {
                                
@@ -382,7 +383,7 @@ int ChimeraPintailCommand::execute(){
                        templateSeqsLength = chimera->getLength();
                
                #ifdef USE_MPI
-                       int pid, end, numSeqsPerProcessor; 
+                       int pid, numSeqsPerProcessor; 
                                int tag = 2001;
                                vector<unsigned long int> MPIPos;
                                
@@ -631,7 +632,7 @@ int ChimeraPintailCommand::driverMPI(int start, int num, MPI_File& inMPI, MPI_Fi
                                        if (m->control_pressed) {       delete candidateSeq; return 1;  }
                
                                        //print results
-                                       bool isChimeric = chimera->print(outMPI, outAccMPI);
+                                       chimera->print(outMPI, outAccMPI);
                                }
                        }
                        delete candidateSeq;
@@ -678,7 +679,11 @@ int ChimeraPintailCommand::createProcesses(string outputFileName, string filenam
                                out.close();
 
                                exit(0);
-                       }else { m->mothurOut("unable to spawn the necessary processes."); m->mothurOutEndLine(); exit(0); }
+                       }else { 
+                               m->mothurOut("[ERROR]: unable to spawn the necessary processes."); m->mothurOutEndLine(); 
+                               for (int i = 0; i < processIDS.size(); i++) { kill (processIDS[i], SIGINT); }
+                               exit(0);
+                       }
                }
                
                //force parent to wait until all the processes are done