]> git.donarmstrong.com Git - mothur.git/blobdiff - systemcommand.cpp
captured stdout from system command, fixed bug in trim.seqs added error checks for...
[mothur.git] / systemcommand.cpp
index 129ed8012fe92aafe37ec8946a2f3367d3da79ce..e5aeb3e8b73dfb59008f6ddccaa3b0703b25e696 100644 (file)
@@ -91,7 +91,19 @@ int SystemCommand::execute(){
                
                if (abort == true) { if (calledHelp) { return 0; }  return 2;   }
                
-               system(command.c_str());
+               //system(command.c_str());
+               FILE *lsofFile_p = popen(command.c_str(), "r");
+               
+               if (!lsofFile_p) { return 0; }
+               
+               char buffer[1024];
+               while ( fgets(buffer, 1024, lsofFile_p) != NULL ) {
+                       string temp = buffer;
+                       m->mothurOut(temp); 
+               }
+               m->mothurOutEndLine();
+               
+               pclose(lsofFile_p);
                
                return 0;               
        }