Intended process exit code when the last uncaught error is `SystemExit` with an integer (or absent/None) argument. `None` means "not a plain SystemExit", so the host renders a normal traceback; a non-int argument also yields `None` so its message surfaces as an error. */
(&self)
| 20 | |
| 21 | /* Intended process exit code when the last uncaught error is `SystemExit` with an integer (or absent/None) argument. `None` means "not a plain SystemExit", so the host renders a normal traceback; a non-int argument also yields `None` so its message surfaces as an error. */ |
| 22 | pub fn system_exit_code(&self) -> Option<i64> { |
| 23 | let exc = self.pending.exc_val?; |
| 24 | let HeapObj::ExcInstance(name, args) = self.heap.get(exc) else { return None; }; |
| 25 | if name != "SystemExit" { return None; } |
| 26 | match args.first() { |
| 27 | None => Some(0), |
| 28 | Some(a) if a.is_none() => Some(0), |
| 29 | Some(a) if a.is_int() => Some(a.as_int()), |
| 30 | _ => None, |
| 31 | } |
| 32 | } |
| 33 | |
| 34 | pub fn call_stack_frames(&self) -> &[CallFrame] { &self.call_stack } |
| 35 | pub fn function_names_ref(&self) -> &[String] { &self.function_names } |