diff options
author | iximeow <git@iximeow.net> | 2022-12-29 09:19:07 +0000 |
---|---|---|
committer | iximeow <git@iximeow.net> | 2022-12-29 09:19:07 +0000 |
commit | e28b277980763b88d2828812bff2c0b9546d3d25 (patch) | |
tree | 34fe85309adb4170662951b3fb179f7441631e22 /src/lua | |
parent | 7801ace71a60f9c16497d99f760c14529a2d63d3 (diff) |
do not use buggy AsyncWrite impl for file transfer, spawn_blocking a blocking task
Diffstat (limited to 'src/lua')
-rw-r--r-- | src/lua/mod.rs | 16 |
1 files changed, 9 insertions, 7 deletions
diff --git a/src/lua/mod.rs b/src/lua/mod.rs index 75b9cec..f186e6b 100644 --- a/src/lua/mod.rs +++ b/src/lua/mod.rs @@ -224,13 +224,15 @@ impl BuildEnv { pub async fn run_build(self, script: &[u8]) -> Result<(), LuaError> { let script = script.to_vec(); - let res: Result<(), LuaError> = std::thread::spawn(move || { - self.lua.context(|lua_ctx| { - lua_ctx.load(&script) - .set_name("goodfile")? - .exec() - }) - }).join().unwrap(); + let res: Result<(), LuaError> = tokio::task::spawn_blocking(|| { + std::thread::spawn(move || { + self.lua.context(|lua_ctx| { + lua_ctx.load(&script) + .set_name("goodfile")? + .exec() + }) + }).join().unwrap() + }).await.unwrap(); eprintln!("lua res: {:?}", res); res } |