Only load LOCAL_STREAMS if they are being used
This commit is contained in:
parent
d0d0e78208
commit
db15596c57
1 changed files with 5 additions and 0 deletions
|
@ -963,6 +963,11 @@ pub fn set_print(sink: Option<Box<dyn LocalOutput>>) -> Option<Box<dyn LocalOutp
|
|||
}
|
||||
|
||||
pub(crate) fn clone_io() -> (Option<Box<dyn LocalOutput>>, Option<Box<dyn LocalOutput>>) {
|
||||
// Don't waste time when LOCAL_{STDOUT,STDERR} are definitely None.
|
||||
if !LOCAL_STREAMS.load(Ordering::Relaxed) {
|
||||
return (None, None);
|
||||
}
|
||||
|
||||
LOCAL_STDOUT.with(|stdout| {
|
||||
LOCAL_STDERR.with(|stderr| {
|
||||
(
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue