X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=systemcommand.cpp;h=e5aeb3e8b73dfb59008f6ddccaa3b0703b25e696;hb=43835751a12097ea9d46a4ce68e2671ba7aff9d4;hp=129ed8012fe92aafe37ec8946a2f3367d3da79ce;hpb=4de093e3b92bdab1579565cb2873553412f6671e;p=mothur.git diff --git a/systemcommand.cpp b/systemcommand.cpp index 129ed80..e5aeb3e 100644 --- a/systemcommand.cpp +++ b/systemcommand.cpp @@ -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; }