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)