about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--src/libstd/logging.rs6
-rw-r--r--src/test/run-pass/issue-10626.rs40
2 files changed, 45 insertions, 1 deletions
diff --git a/src/libstd/logging.rs b/src/libstd/logging.rs
index 1c464110ce0..4af6d1d53be 100644
--- a/src/libstd/logging.rs
+++ b/src/libstd/logging.rs
@@ -110,7 +110,11 @@ pub fn log(_level: u32, args: &fmt::Arguments) {
                 match (*local).logger {
                     // Use the available logger if we have one
                     Some(ref mut logger) => return logger.log(args),
-                    None => {}
+                    None => {
+                        let mut logger = StdErrLogger::new();
+                        logger.log(args);
+                        (*local).logger = Some(logger);
+                    }
                 }
             }
             None => {}
diff --git a/src/test/run-pass/issue-10626.rs b/src/test/run-pass/issue-10626.rs
new file mode 100644
index 00000000000..02c1e47ddc1
--- /dev/null
+++ b/src/test/run-pass/issue-10626.rs
@@ -0,0 +1,40 @@
+// Copyright 2013 The Rust Project Developers. See the COPYRIGHT
+// file at the top-level directory of this distribution and at
+// http://rust-lang.org/COPYRIGHT.
+//
+// Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
+// http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
+// <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
+// option. This file may not be copied, modified, or distributed
+// except according to those terms.
+
+// xfail-fast
+
+// Make sure that if a process doesn't have its stdio/stderr descriptors set up
+// that we don't die in a large ball of fire
+
+use std::os;
+use std::io::process;
+
+fn main () {
+    let args = os::args();
+    if args.len() > 1 && args[1] == ~"child" {
+        for _ in range(0, 1000) {
+            error!("hello?");
+        }
+        for _ in range(0, 1000) {
+            println!("hello?");
+        }
+    }
+
+    let config = process::ProcessConfig {
+        program : args[0].as_slice(),
+        args : [~"child"],
+        env : None,
+        cwd : None,
+        io : []
+    };
+
+    let mut p = process::Process::new(config).unwrap();
+    println!("{}", p.wait());
+}