about summary refs log tree commit diff
path: root/tests/ui/runtime/stdout-during-shutdown-unix.rs
diff options
context:
space:
mode:
authorBen Kimock <kimockb@gmail.com>2024-04-18 17:49:07 -0400
committerBen Kimock <kimockb@gmail.com>2024-05-20 11:13:10 -0400
commit7a906e1af71684138702a85fe114def61f21379d (patch)
treec6fb5cea0039aa89497e9ce2e92ff017e5739499 /tests/ui/runtime/stdout-during-shutdown-unix.rs
parent70147cd3ab30a0f1c6677db0581a17a4bcf5f85d (diff)
downloadrust-7a906e1af71684138702a85fe114def61f21379d.tar.gz
rust-7a906e1af71684138702a85fe114def61f21379d.zip
Port stdout-during-shutdown
Diffstat (limited to 'tests/ui/runtime/stdout-during-shutdown-unix.rs')
-rw-r--r--tests/ui/runtime/stdout-during-shutdown-unix.rs20
1 files changed, 20 insertions, 0 deletions
diff --git a/tests/ui/runtime/stdout-during-shutdown-unix.rs b/tests/ui/runtime/stdout-during-shutdown-unix.rs
new file mode 100644
index 00000000000..8e0f1d371ae
--- /dev/null
+++ b/tests/ui/runtime/stdout-during-shutdown-unix.rs
@@ -0,0 +1,20 @@
+//@ run-pass
+//@ check-run-results
+//@ ignore-emscripten
+//@ only-unix
+
+// Emscripten doesn't flush its own stdout buffers on exit, which would fail
+// this test. So this test is disabled on this platform.
+// See https://emscripten.org/docs/getting_started/FAQ.html#what-does-exiting-the-runtime-mean-why-don-t-atexit-s-run
+
+#![feature(rustc_private)]
+
+extern crate libc;
+
+fn main() {
+    extern "C" fn bye() {
+        print!(", world!");
+    }
+    unsafe { libc::atexit(bye) };
+    print!("hello");
+}