mirror of
https://github.com/denoland/deno.git
synced 2024-12-27 09:39:08 -05:00
55595ca1b7
Fixes https://github.com/denoland/deno/issues/16934 Example compiler error: ``` error: mutable opstate is not supported in async ops --> core/ops_builtin.rs:122:1 | 122 | #[op] | ^^^^^ | = note: this error originates in the attribute macro `op` (in Nightly builds, run with -Z macro-backtrace for more info) ```
11 lines
371 B
Rust
11 lines
371 B
Rust
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(())
|
|
}
|