def handle_subsolver(self):
        # spawn solver
        limit = 0.0
        stdout = ""
        expenditure = datetime.timedelta(seconds = limit)
        last_expenditure = expenditure
        last_audit = time.time() - 1.0

        while limit == 0.0 or self._popened is not None:
            if expenditure >= datetime.timedelta(seconds = limit):
                if self._popened is not None:
                    os.kill(popened.pid, signal.SIGSTOP)

                    run_cost = borg.util.seconds(expenditure - last_expenditure)
                    self._stm_queue.put((self._solver_id, run_cost, None, False))

                additional = self._mts_queue.get()
                limit += additional
                last_expenditure = expenditure

                if self._popened is None:
                    popened = borg.unix.sessions.spawn_pipe_session(self._arguments, cwd = self._cwd)
                    self._popened = popened

                    descriptors = [popened.stdout.fileno(), popened.stderr.fileno()]
                    accountant = borg.unix.accounting.SessionTimeAccountant(popened.pid)
                else:
                    os.kill(popened.pid, signal.SIGCONT)

            # spend some time waiting for output
            (chunk, _) = timed_read(descriptors, 1.0)

            if time.time() - last_audit > borg.defaults.proc_poll_period:
                accountant.audit()

                expenditure = accountant.total
                last_audit = time.time()

            # check for termination
            if chunk == "":
                self._popened = None
            elif chunk is not None:
                stdout += chunk

        # provide the outcome to the central planner
        answer = self._parse_output(stdout)
        run_cost = borg.util.seconds(expenditure - last_expenditure)

        self._stm_queue.put((self._solver_id, run_cost, answer, True))
dataset/ETHPy150Open borg-project/borg/borg/solver_io.py/SolverProcess.handle_subsolver/original