Here is some sample code I threw together last week for a similar issue.
In reply to Re: Read a process output asynchronously by delirium in thread Read a process output asynchronously by redbrick