waitToFinish - Wait (Block current thread), optionally with a timeout, until background task completes.

            @param timeout <None/float> - None to wait forever, otherwise max number of seconds to wait
            @param pollInterval <float> - Seconds between each poll. Keep high if interactivity is not important, low if it is.

            @return - None if process did not complete (and timeout occured), otherwise the return code of the process is returned.

def waitToFinish(self, timeout=None, pollInterval=.1):
        '''
            waitToFinish - Wait (Block current thread), optionally with a timeout, until background task completes.

            @param timeout <None/float> - None to wait forever, otherwise max number of seconds to wait
            @param pollInterval <float> - Seconds between each poll. Keep high if interactivity is not important, low if it is.

            @return - None if process did not complete (and timeout occured), otherwise the return code of the process is returned.
        '''
        if timeout is None:
            while self.isFinished is False:
                time.sleep(pollInterval)
        else:
            sleptFor = 0
            while self.isFinished is False and sleptFor < timeout:
                time.sleep(pollInterval)
                sleptFor += pollInterval

        return self.returnCode