Skip to content

Commit

Permalink
Restore output_thread_body
Browse files Browse the repository at this point in the history
  • Loading branch information
jmthomas committed Feb 13, 2025
1 parent f8a88fa commit d3ce3f8
Showing 1 changed file with 13 additions and 1 deletion.
14 changes: 13 additions & 1 deletion openc3-cosmos-script-runner-api/scripts/running_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -976,7 +976,7 @@ def run_thread_body(
# Start Output Thread
if not RunningScript.output_thread:
RunningScript.output_thread = threading.Thread(
target=RunningScript.output_thread, daemon=True
target=RunningScript.output_thread_body, daemon=True
)
RunningScript.output_thread.start()

Expand Down Expand Up @@ -1217,6 +1217,18 @@ def redirect_io(self):
Logger.stdout = True
Logger.level = Logger.INFO

def output_thread_body(self):
RunningScript.cancel_output = False
RunningScript.output_sleeper = Sleeper()
while True:
if RunningScript.cancel_output:
break
if (time.time() - self.output_time) > 5.0:
self.handle_output_io()
if RunningScript.cancel_output:
break
if RunningScript.output_sleeper.sleep(1.0):
break

openc3.script.RUNNING_SCRIPT = RunningScript

Expand Down

0 comments on commit d3ce3f8

Please sign in to comment.