mirror of
https://github.com/nushell/nushell
synced 2024-11-10 15:14:14 +00:00
Don't create a thread if stderr_stream is None (#11421)
# Description There is no need to create a thread if `stderr_stream` is `None`.
This commit is contained in:
parent
913c2b8d1c
commit
534287ed65
1 changed files with 7 additions and 4 deletions
|
@ -861,10 +861,13 @@ pub fn print_if_stream(
|
|||
// NOTE: currently we don't need anything from stderr
|
||||
// so we just consume and throw away `stderr_stream` to make sure the pipe doesn't fill up
|
||||
|
||||
thread::Builder::new()
|
||||
.name("stderr consumer".to_string())
|
||||
.spawn(move || stderr_stream.map(|x| x.into_bytes()))
|
||||
.expect("could not create thread");
|
||||
if let Some(stderr_stream) = stderr_stream {
|
||||
thread::Builder::new()
|
||||
.name("stderr consumer".to_string())
|
||||
.spawn(move || stderr_stream.into_bytes())
|
||||
.expect("could not create thread");
|
||||
}
|
||||
|
||||
if let Some(stream) = stream {
|
||||
for s in stream {
|
||||
let s_live = s?;
|
||||
|
|
Loading…
Reference in a new issue