Grab output from ofSystem while the process is running


Hello OF community,

For a project I am working on, I need to scrape data from a webpage and display it on screen, so I am using phantomJS, which is a headless browser. Therefore, I need to start and run phantomJS in a loop from within OF and continuously grab its output from console.

I am using a threaded ofSystem call, which kind of works except for the fact that ofSystem only returns the output when phantomJS exits, which does not work for me, since I need phantomJS running continuously in a loop. From what I am seeing, ofSystem only returns the results of a command when the process is terminated. Is that the correct behavior? If that is the case, is there any way to run a threaded process and grab its output while it is running?

Thanks for the help!