Skip to content

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

Closed
@japaric

Description

@japaric
Member

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

Activity

added a commit that references this issue on Mar 28, 2014
0e190b9
added a commit that references this issue on Mar 28, 2014

auto merge of #13131 : alexcrichton/rust/issue-13124, r=brson

fd4f15e
added a commit that references this issue on Jul 25, 2024

Auto merge of rust-lang#13124 - xFrednet:00000-lintcheck-crates, r=Al…

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

      Development

      Participants

      @japaric

      Issue actions

        Process::signal(0) returns Ok() when child process was killed externally · Issue #13124 · rust-lang/rust