Skip to content

Process::signal(0) returns Ok() when child process was killed externally #13124

Closed
@japaric

Description

@japaric

Scripts to reproduce

// loopback.rs
use std::io::stdio::stdin;

fn main() {
    for line in stdin().lines() {
        match line {
            Ok(line) => print!("{}", line),
            Err(e)   => fail!("whoops: {}", e),
        }
    }
}
// heartbeat.rs
use std::io::process::Process;
use std::io::timer::Timer;

fn main() {
    let mut timer = Timer::new().unwrap();
    let periodic = timer.periodic(1000);

    let mut child = Process::new("./loopback", []).unwrap();

    loop {
        match child.signal(0) {
            Err(_) => fail!("child process is dead"),
            Ok(_)  => println!("*heartbeat*"),
        }

        periodic.recv();
    }
}

Steps to reproduce:

$ ./heartbeat
$ killall loopback
# heartbeat never ends

Version:

rustc 0.10-pre (e6468a8 2014-03-24 10:01:57 -0700)
host: x86_64-unknown-linux-gnu

Probably related to issue #13123

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