Do not lock stderr in UIThreadInner

which will prevent other thread from `eprintln!`.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2022-06-19 01:46:13 +10:00
parent f5514c834b
commit d4eb56d017
No known key found for this signature in database
GPG key ID: 591C0B03040416D6

View file

@ -41,7 +41,6 @@ impl UIThreadInner {
// access stdin
let mut stdin = io::stdin().lock();
let mut stdout = io::stdout().lock();
let mut stderr = io::stderr().lock();
let mut input = String::with_capacity(16);
loop {
@ -69,7 +68,9 @@ impl UIThreadInner {
.expect("entry exits when confirming request")
}
Ok(UIRequest::PrintToStdout(output)) => stdout.write_all(&output).unwrap(),
Ok(UIRequest::PrintToStderr(output)) => stderr.write_all(&output).unwrap(),
Ok(UIRequest::PrintToStderr(output)) => {
io::stderr().write_all(&output).unwrap()
}
Ok(UIRequest::FlushStdout) => stdout.flush().unwrap(),
Err(_) => break,
}