]> git.lizzy.rs Git - rust.git/blobdiff - src/libstd/sys/wasm/stdio.rs
Refactor stderr_prints_nothing into a more modular function
[rust.git] / src / libstd / sys / wasm / stdio.rs
index 023f29576a27d9c4dd667b1a035d9966de5efcfe..e51aba75333b651bcca5fdb213d631b100c5a88a 100644 (file)
@@ -70,6 +70,10 @@ pub fn is_ebadf(_err: &io::Error) -> bool {
     true
 }
 
-pub fn stderr_prints_nothing() -> bool {
-    !cfg!(feature = "wasm_syscall")
+pub fn panic_output() -> Option<impl io::Write> {
+    if cfg!(feature = "wasm_syscall") {
+        Stderr::new().ok()
+    } else {
+        None
+    }
 }