mirror of
https://github.com/sxyazi/yazi.git
synced 2024-12-25 17:54:57 +03:00
fix: close stdin before waiting for child process (#1464)
This commit is contained in:
parent
dac72eb39a
commit
ce944bca88
@ -90,6 +90,7 @@ impl UserData for Child {
|
|||||||
});
|
});
|
||||||
|
|
||||||
methods.add_async_method_mut("wait", |lua, me, ()| async move {
|
methods.add_async_method_mut("wait", |lua, me, ()| async move {
|
||||||
|
drop(me.stdin.take());
|
||||||
match me.inner.wait().await {
|
match me.inner.wait().await {
|
||||||
Ok(status) => (Status::new(status), Value::Nil).into_lua_multi(lua),
|
Ok(status) => (Status::new(status), Value::Nil).into_lua_multi(lua),
|
||||||
Err(e) => (Value::Nil, e.raw_os_error()).into_lua_multi(lua),
|
Err(e) => (Value::Nil, e.raw_os_error()).into_lua_multi(lua),
|
||||||
@ -111,6 +112,7 @@ impl UserData for Child {
|
|||||||
let stdout_fut = read_to_end(&mut stdout_pipe);
|
let stdout_fut = read_to_end(&mut stdout_pipe);
|
||||||
let stderr_fut = read_to_end(&mut stderr_pipe);
|
let stderr_fut = read_to_end(&mut stderr_pipe);
|
||||||
|
|
||||||
|
drop(me.stdin.take());
|
||||||
let result = try_join3(me.inner.wait(), stdout_fut, stderr_fut).await;
|
let result = try_join3(me.inner.wait(), stdout_fut, stderr_fut).await;
|
||||||
drop(stdout_pipe);
|
drop(stdout_pipe);
|
||||||
drop(stderr_pipe);
|
drop(stderr_pipe);
|
||||||
|
Loading…
Reference in New Issue
Block a user