about summary refs log tree commit diff
path: root/compiler/rustc_session
diff options
context:
space:
mode:
authorRain <rain@sunshowers.io>2022-09-22 22:48:14 -0700
committerRain <rain@sunshowers.io>2022-10-20 14:53:38 -0700
commita52c79e859142c1cd5c0c5bdb73f16b754e1b98f (patch)
treeac8aea871f084c1521a9ee86c6adc3cf19313967 /compiler/rustc_session
parent542febd2d383b5082277c7d165b098c0a3b513f6 (diff)
downloadrust-a52c79e859142c1cd5c0c5bdb73f16b754e1b98f.tar.gz
rust-a52c79e859142c1cd5c0c5bdb73f16b754e1b98f.zip
Change process spawning to inherit the parent's signal mask by default
Previously, the signal mask is always reset when a child process is
started. This breaks tools like `nohup` which expect `SIGHUP` to be
blocked.

With this change, the default behavior changes to inherit the signal mask.

This also changes the signal disposition for `SIGPIPE` to only be
changed if the `#[unix_sigpipe]` attribute isn't set.
Diffstat (limited to 'compiler/rustc_session')
-rw-r--r--compiler/rustc_session/src/config/sigpipe.rs13
1 files changed, 8 insertions, 5 deletions
diff --git a/compiler/rustc_session/src/config/sigpipe.rs b/compiler/rustc_session/src/config/sigpipe.rs
index a5c94118a47..53692ad7cc9 100644
--- a/compiler/rustc_session/src/config/sigpipe.rs
+++ b/compiler/rustc_session/src/config/sigpipe.rs
@@ -1,5 +1,13 @@
 //! NOTE: Keep these constants in sync with `library/std/src/sys/unix/mod.rs`!
 
+/// The default value if `#[unix_sigpipe]` is not specified. This resolves
+/// to `SIG_IGN` in `library/std/src/sys/unix/mod.rs`.
+///
+/// Note that `SIG_IGN` has been the Rust default since 2014. See
+/// <https://github.com/rust-lang/rust/issues/62569>.
+#[allow(dead_code)]
+pub const DEFAULT: u8 = 0;
+
 /// Do not touch `SIGPIPE`. Use whatever the parent process uses.
 #[allow(dead_code)]
 pub const INHERIT: u8 = 1;
@@ -15,8 +23,3 @@ pub const SIG_IGN: u8 = 2;
 /// such as `head -n 1`.
 #[allow(dead_code)]
 pub const SIG_DFL: u8 = 3;
-
-/// `SIG_IGN` has been the Rust default since 2014. See
-/// <https://github.com/rust-lang/rust/issues/62569>.
-#[allow(dead_code)]
-pub const DEFAULT: u8 = SIG_IGN;