signal: Add SignalKind for registering signals more easily (#1430)

This avoids having consumers import libc for common signals, and it
improves discoverability since users need not be aware that libc
contains all supported constants.
This commit is contained in:
Ivan Petkov
2019-08-13 21:07:22 -07:00
committed by Carl Lerche
parent 513326e01d
commit 338b37884a
13 changed files with 169 additions and 69 deletions
+2 -2
View File
@@ -40,7 +40,7 @@ use std::process::{self, ExitStatus};
use std::task::Context;
use std::task::Poll;
use tokio_reactor::{Handle, PollEvented};
use tokio_signal::unix::Signal;
use tokio_signal::unix::{Signal, SignalKind};
impl Wait for process::Child {
fn id(&self) -> u32 {
@@ -99,7 +99,7 @@ pub(crate) fn spawn_child(cmd: &mut process::Command, handle: &Handle) -> io::Re
let stdout = stdio(child.stdout.take(), handle)?;
let stderr = stdio(child.stderr.take(), handle)?;
let signal = Signal::with_handle(libc::SIGCHLD, handle)?;
let signal = Signal::with_handle(SignalKind::sigchld(), handle)?;
Ok(SpawnedChild {
child: Child {