1
0
Fork 0
mirror of https://github.com/denoland/deno.git synced 2024-12-11 18:17:48 -05:00
denoland-deno/ops/optimizer_tests/issue16934.rs

12 lines
371 B
Rust
Raw Normal View History

async fn send_stdin(
state: &mut OpState,
cmd: String,
) -> Result<(), anyhow::Error> {
// https://github.com/denoland/deno/issues/16934
//
// OpState borrowed across await point is not allowed, as it will likely panic at runtime.
let instance = state.borrow::<MinecraftInstance>().clone();
instance.send_command(&cmd, CausedBy::Unknown).await?;
Ok(())
}