File tree 1 file changed +8
-0
lines changed
1 file changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -905,6 +905,10 @@ impl fmt::Debug for StderrLock<'_> {
905
905
#[ doc( hidden) ]
906
906
pub fn set_panic ( sink : Option < Box < dyn Write + Send > > ) -> Option < Box < dyn Write + Send > > {
907
907
use crate :: mem;
908
+ if sink. is_none ( ) && !LOCAL_STREAMS . load ( Ordering :: Relaxed ) {
909
+ // LOCAL_STDERR is definitely None since LOCAL_STREAMS is false.
910
+ return None ;
911
+ }
908
912
let s = LOCAL_STDERR . with ( move |slot| mem:: replace ( & mut * slot. borrow_mut ( ) , sink) ) . and_then (
909
913
|mut s| {
910
914
let _ = s. flush ( ) ;
@@ -932,6 +936,10 @@ pub fn set_panic(sink: Option<Box<dyn Write + Send>>) -> Option<Box<dyn Write +
932
936
#[ doc( hidden) ]
933
937
pub fn set_print ( sink : Option < Box < dyn Write + Send > > ) -> Option < Box < dyn Write + Send > > {
934
938
use crate :: mem;
939
+ if sink. is_none ( ) && !LOCAL_STREAMS . load ( Ordering :: Relaxed ) {
940
+ // LOCAL_STDOUT is definitely None since LOCAL_STREAMS is false.
941
+ return None ;
942
+ }
935
943
let s = LOCAL_STDOUT . with ( move |slot| mem:: replace ( & mut * slot. borrow_mut ( ) , sink) ) . and_then (
936
944
|mut s| {
937
945
let _ = s. flush ( ) ;
You can’t perform that action at this time.
0 commit comments