diff options
author | Andreu Botella <andreu@andreubotella.com> | 2022-05-13 10:36:31 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-13 10:36:31 +0200 |
commit | 3e7afb8918fd0f6cedf839a7ebaae6aaee5e66ad (patch) | |
tree | 7fcc92da290889d3d2290f6e4902ac60685aae87 /runtime/ops | |
parent | 0ee76da07b12fba38962634e65853d73adf9d4c0 (diff) |
chore(runtime): Make some ops in ext and runtime infallible. (#14589)
Co-authored-by: Aaron O'Mullan <aaron.omullan@gmail.com>
Diffstat (limited to 'runtime/ops')
-rw-r--r-- | runtime/ops/os.rs | 5 | ||||
-rw-r--r-- | runtime/ops/web_worker.rs | 7 | ||||
-rw-r--r-- | runtime/ops/worker_host.rs | 6 |
3 files changed, 6 insertions, 12 deletions
diff --git a/runtime/ops/os.rs b/runtime/ops/os.rs index ad2ff60ea..c74a423ab 100644 --- a/runtime/ops/os.rs +++ b/runtime/ops/os.rs @@ -103,13 +103,12 @@ fn op_delete_env(state: &mut OpState, key: String) -> Result<(), AnyError> { } #[op] -fn op_set_exit_code(state: &mut OpState, code: i32) -> Result<(), AnyError> { +fn op_set_exit_code(state: &mut OpState, code: i32) { state.borrow_mut::<Arc<AtomicI32>>().store(code, Relaxed); - Ok(()) } #[op] -fn op_exit(state: &mut OpState) -> Result<(), AnyError> { +fn op_exit(state: &mut OpState) { let code = state.borrow::<Arc<AtomicI32>>().load(Relaxed); std::process::exit(code) } diff --git a/runtime/ops/web_worker.rs b/runtime/ops/web_worker.rs index 4137217bd..184ebfddb 100644 --- a/runtime/ops/web_worker.rs +++ b/runtime/ops/web_worker.rs @@ -55,16 +55,15 @@ async fn op_worker_recv_message( } #[op] -fn op_worker_close(state: &mut OpState) -> Result<(), AnyError> { +fn op_worker_close(state: &mut OpState) { // Notify parent that we're finished let mut handle = state.borrow_mut::<WebWorkerInternalHandle>().clone(); handle.terminate(); - Ok(()) } #[op] -fn op_worker_get_type(state: &mut OpState) -> Result<WebWorkerType, AnyError> { +fn op_worker_get_type(state: &mut OpState) -> WebWorkerType { let handle = state.borrow::<WebWorkerInternalHandle>().clone(); - Ok(handle.worker_type) + handle.worker_type } diff --git a/runtime/ops/worker_host.rs b/runtime/ops/worker_host.rs index bd1f1e3f5..f8831d4e9 100644 --- a/runtime/ops/worker_host.rs +++ b/runtime/ops/worker_host.rs @@ -258,16 +258,12 @@ fn op_create_worker( } #[op] -fn op_host_terminate_worker( - state: &mut OpState, - id: WorkerId, -) -> Result<(), AnyError> { +fn op_host_terminate_worker(state: &mut OpState, id: WorkerId) { if let Some(worker_thread) = state.borrow_mut::<WorkersTable>().remove(&id) { worker_thread.terminate(); } else { debug!("tried to terminate non-existent worker {}", id); } - Ok(()) } enum WorkerChannel { |