<SYSTEM_TASK:>
Solve the following problem using Python, implementing the functions described below, one line at a time
<END_TASK>
<USER_TASK:>
Description:
 def monitor_running_process(context: RunContext):
 """ Runs an infinite loop that waits for the process to either exit on its or time out Captures all output from the running process :param context: run context :type context: RunContext """

    while True:
        capture_output_from_running_process(context)

        if context.process_finished():
            context.return_code = context.command.returncode
            break

        if context.process_timed_out():
            context.return_code = -1
            raise ProcessTimeoutError(
                exe_name=context.exe_short_name,
                timeout=context.timeout,
            )