Skip to content

Commit 9dae818

Browse files
author
JasperVanEsveld
authored
fix(compile): panic when calling op_is_terminal (#1116)
This works towards fixing [#27730](denoland/deno#27730) and [#21091](denoland/deno#21091). An error is not handled when calling `op_is_terminal`. Ironically, this causes the application to panic when bootstrapping if there is no terminal in windows. This PR does not fully fix the issue yet, as there is a similar problem in deno's code base, see this [pull request](denoland/deno#28823).
1 parent ec04024 commit 9dae818

File tree

1 file changed

+5
-6
lines changed

1 file changed

+5
-6
lines changed

core/ops_builtin.rs

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -465,12 +465,11 @@ fn op_encode_binary_string(#[buffer] s: &[u8]) -> ByteString {
465465
}
466466

467467
#[op2(fast)]
468-
fn op_is_terminal(
469-
state: &mut OpState,
470-
#[smi] rid: ResourceId,
471-
) -> Result<bool, ResourceError> {
472-
let handle = state.resource_table.get_handle(rid)?;
473-
Ok(handle.is_terminal())
468+
fn op_is_terminal(state: &mut OpState, #[smi] rid: ResourceId) -> bool {
469+
match state.resource_table.get_handle(rid) {
470+
Ok(handle) => handle.is_terminal(),
471+
_ => false,
472+
}
474473
}
475474

476475
async fn do_load_job(

0 commit comments

Comments
 (0)