From 0c39a9eefba41f056bf666610292bff265b4dccc Mon Sep 17 00:00:00 2001 From: Anton Lydike Date: Fri, 8 Apr 2022 21:00:56 +0200 Subject: [PATCH] fixes #12 - exit program with code from cpu.exit_code --- riscemu/__main__.py | 3 ++- riscemu/interactive.py | 4 ++++ 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/riscemu/__main__.py b/riscemu/__main__.py index cc62114..1d46d31 100644 --- a/riscemu/__main__.py +++ b/riscemu/__main__.py @@ -121,9 +121,10 @@ if __name__ == '__main__': # launch the last loaded program cpu.launch(cpu.mmu.programs[-1], verbose=cfg.verbosity > 1) + sys.exit(cpu.exit_code) except RiscemuBaseException as e: print("Error: {}".format(e.message())) e.print_stacktrace() - sys.exit(1) + sys.exit(-1) diff --git a/riscemu/interactive.py b/riscemu/interactive.py index 5b6b088..2a85da3 100644 --- a/riscemu/interactive.py +++ b/riscemu/interactive.py @@ -1,3 +1,5 @@ +import sys + from riscemu import RunConfig from riscemu.types import InstructionMemorySection, SimpleInstruction, Program @@ -22,3 +24,5 @@ if __name__ == '__main__': cpu.setup_stack() cpu.launch(program) + + sys.exit(cpu.exit_code)