raz / test / run / ExitStatus.raz

20 lines · 437 B · raw · history · last change 7924cbb7

1(* Rt.exitStatus is 0 in main and the status exit was given in the
2 procedures atExit registered, also when a check or stop ends the
3 program. *)
4module ExitStatus;
5import Out, Rt;
6
7proc report;
8begin
9 Out.str("ending with "); Out.int(Rt.exitStatus()); Out.str("\n");
10end;
11
12proc main*: INT;
13begin
14 _ := Rt.atExit(report);
15 Out.int(Rt.exitStatus()); Out.str(" in main\n");
16 Rt.exit(7);
17 return 0;
18end;
19
20end ExitStatus.