summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Bridle <ben@derelict.engineering>2024-10-31 18:07:19 +1300
committerBen Bridle <ben@derelict.engineering>2024-10-31 18:07:37 +1300
commit825a023c2cd77716ee54a0ecfeb65618e0940a71 (patch)
tree084819a694903f4ab433bcc5c32453986f0a5b4c
parentd31a97811b94fa4403939c289eaf98eaca237b0e (diff)
downloadbedrock-pc-825a023c2cd77716ee54a0ecfeb65618e0940a71.zip
Flush standard output before printing halt message
This ensures that no additional program output will be printed after the debug-mode halt message is printed.
-rw-r--r--src/emulators/graphical_emulator.rs2
-rw-r--r--src/emulators/headless_emulator.rs1
2 files changed, 3 insertions, 0 deletions
diff --git a/src/emulators/graphical_emulator.rs b/src/emulators/graphical_emulator.rs
index bc6aaeb..8652aad 100644
--- a/src/emulators/graphical_emulator.rs
+++ b/src/emulators/graphical_emulator.rs
@@ -146,6 +146,7 @@ impl GraphicalEmulator {
std::thread::sleep(MIN_TICK_DURATION);
}
Some(Signal::Halt) => {
+ self.br.dev.loc.flush();
self.debug.print("Program halted, exiting.");
self.debug.debug_summary(&self.br.core);
return EmulatorSignal::Halt;
@@ -284,6 +285,7 @@ impl WindowProgram for GraphicalEmulator {
break;
}
Some(Signal::Halt) => {
+ self.br.dev.loc.flush();
self.debug.print("Program halted, exiting.");
self.debug.debug_summary(&self.br.core);
requests.write(Request::CloseWindow);
diff --git a/src/emulators/headless_emulator.rs b/src/emulators/headless_emulator.rs
index 3f54f6a..03fbcf9 100644
--- a/src/emulators/headless_emulator.rs
+++ b/src/emulators/headless_emulator.rs
@@ -110,6 +110,7 @@ impl HeadlessEmulator {
std::thread::sleep(MIN_TICK_DURATION);
}
Some(Signal::Halt) => {
+ self.br.dev.loc.flush();
self.debug.print("Program halted, exiting.");
self.debug.debug_summary(&self.br.core);
return EmulatorSignal::Halt;