Skip to content

logging macros and writeln!() crash if stderr is redirected to /dev/null #10626

Closed
@dwrensha

Description

@dwrensha

The following occurs for me on Mac OSX 10.9.

// child.rs
fn main() {
    for _ in range::<uint>(0, 1000) {
        error!("hello?");
    }
}
// parent.rs
fn main () {
    use std::io::process;

    let config = process::ProcessConfig {
        program : "./child",
        args : [],
        env : None,
        cwd : None,
        io : []
    };

    match process::Process::new(config) {
        Some(ref mut p) => println!("{}", p.wait()),
        None => println("failed to start child")
    }
}

When I run ./parent, I expect the output to be "exit code: 0". Instead, I see an error signal, and not always the same one:

$ ./parent
signal: 6
$ ./parent
signal: 4
$ ./parent
signal: 6
$ ./parent
signal: 6
$ ./parent
signal: 10

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions