feat(Runtime): return raw exit code as i32 instead of ExitCode

This commit is contained in:
Erica Marigold 2024-04-12 16:05:24 +05:30
parent 902c89acab
commit 13198e1851
No known key found for this signature in database
GPG key ID: 2768CC0C23D245D1

View file

@ -64,7 +64,7 @@ impl Runtime {
&mut self, &mut self,
script_name: impl AsRef<str>, script_name: impl AsRef<str>,
script_contents: impl AsRef<[u8]>, script_contents: impl AsRef<[u8]>,
) -> Result<(ExitCode, Vec<Value>), RuntimeError> { ) -> Result<(i32, Vec<Value>), RuntimeError> {
// Create a new scheduler for this run // Create a new scheduler for this run
let sched = Scheduler::new(&self.lua); let sched = Scheduler::new(&self.lua);
@ -93,13 +93,13 @@ impl Runtime {
.into_vec(); .into_vec();
Ok(( Ok((
ExitCode::from(sched.get_exit_code().unwrap_or({ sched.get_exit_code().unwrap_or({
if got_any_error.load(Ordering::SeqCst) { if got_any_error.load(Ordering::SeqCst) {
1 1
} else { } else {
0 0
} }
}) as u8), }),
thread_res, thread_res,
)) ))
} }