runInBackground - Create a background thread which will manage this process, automatically read from streams, and perform any cleanups

          The object returned is a "BackgroundTaskInfo" object, and represents the state of the process. It is updated automatically as the program runs,
            and if stdout or stderr are streams, they are automatically read from and populated into this object.

         @see BackgroundTaskInfo for more info or http://pythonhosted.org/python-subprocess2/subprocess2.BackgroundTask.html

        @param pollInterval - Amount of idle time between polling
        @param encoding - Default False. If provided, data will be decoded using the value of this field as the codec name (e.x. "utf-8"). Otherwise, data will be stored as bytes.

def runInBackground(self, pollInterval=.1, encoding=False):
    '''
        runInBackground - Create a background thread which will manage this process, automatically read from streams, and perform any cleanups

          The object returned is a "BackgroundTaskInfo" object, and represents the state of the process. It is updated automatically as the program runs,
            and if stdout or stderr are streams, they are automatically read from and populated into this object.

         @see BackgroundTaskInfo for more info or http://pythonhosted.org/python-subprocess2/subprocess2.BackgroundTask.html

        @param pollInterval - Amount of idle time between polling
        @param encoding - Default False. If provided, data will be decoded using the value of this field as the codec name (e.x. "utf-8"). Otherwise, data will be stored as bytes.
    '''
        
    from .BackgroundTask import BackgroundTaskThread

    taskInfo = BackgroundTaskInfo(encoding)
    thread = BackgroundTaskThread(self, taskInfo, pollInterval, encoding)

    thread.start()
    #thread.run()  # Uncomment to use pdb debug (will not run in background)
    return taskInfo