Ignore:
Timestamp:
2011-09-21T15:59:57+12:00 (13 years ago)
Author:
jmt12
Message:

Rather than having the Greenstone output sent to some obscure log, use popen to output back through the calling Perl script

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gs2-extensions/parallel-building/trunk/src/src/mpibuildcol-src/mpibuildcol.cpp

    r24589 r24624  
    415415            TiXmlText* text_command = text_grandchild->ToText();
    416416            stringstream commandstrstr;
    417             commandstrstr << text_command->Value();
     417            commandstrstr << text_command->Value() << " 2>&1";
    418418            // - and create the new task given the command string and
    419419            //   accounting for any preqrequisites via the the parent task id
     
    480480    message += command;
    481481    debugPrint(worker_id, message);
    482     system(command); // asynchronous
     482    // asynchronous
     483    //system(command);
     484    FILE *pipe = popen(command, "r");
     485    if (!pipe)
     486    {
     487      cerr << "Warning! Failed to open pipe to command: " << command << endl;
     488    }
     489    else
     490    {
     491      char buffer[1024];
     492      while(fgets(buffer, sizeof(buffer), pipe) != NULL)
     493      {
     494        cout << buffer;
     495      }
     496      pclose(pipe);
     497    }
    483498    // 2. Send a reply back containing the id of the task just completed
    484499    debugPrint(worker_id, "complete");
Note: See TracChangeset for help on using the changeset viewer.