@classmethod
    def executeWithOutput(cls, command, outputCallback=None):
        """
        | Starts a subprocess with given command string. The subprocess is started without shell
        | for safety reason. stderr is send to stdout and stdout is either send to a callback if given or
        | printed on stdout again.
        | If a callback is given for output, it will be called each time a line is printed.

        :param command: a string holding any command line
        :param outputCallback: any callable that we be able to parse line and retrieve useful info from it (usually in the runner)

        :raise CommandError: When any error occurred that should end the command with ERROR status
                             When a subprocess error is raised (OSError or ValueError usually)
        """

        if outputCallback is not None and not callable(outputCallback):
            raise CommandError("Invalid param: outputCallback=%s must be a callable or None" % outputCallback)

        shlex.split(command)
        try:
            p = subprocess.Popen(command.split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT, shell=False, bufsize=1)

            for line in iter(p.stdout.readline, b''):
                if callable(outputCallback):
                    outputCallback(line)
                else:
                    sys.stdout.write(line)

            (stdout, stderr) = p.communicate()
            return p.returncode

        except ValueError as e:
            raise CommandError("%s" % e)

        except __HOLE__ as e:
            raise CommandError("Error during process exec: %s" % e)

        except Exception as e:
            raise e
dataset/ETHPy150Open mikrosimage/OpenRenderManagement/src/puliclient/runner.py/RunnerToolkit.executeWithOutput