Skip to content

Commit 8fe9b3d

Browse files
committed
fix(env): skip uncatchable signals on OpenBSD when applying to all signals
1 parent a142d0c commit 8fe9b3d

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

.vscode/cspell.dictionaries/jargon.wordlist.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -268,3 +268,4 @@ Nofile
268268
rprocess
269269
statat
270270
getdents
271+
SIGTHR

src/uu/env/src/env.rs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1093,7 +1093,16 @@ where
10931093
let Ok(sig) = signal_from_value(sig_value) else {
10941094
return Ok(());
10951095
};
1096-
signal_fn(sig)?;
1096+
match signal_fn(sig) {
1097+
Ok(()) => {}
1098+
Err(_) if !explicit => {
1099+
// When applying to all signals, silently skip signals that
1100+
// the OS refuses to change (e.g. SIGTHR on OpenBSD).
1101+
// GNU env also ignores these.
1102+
return Ok(());
1103+
}
1104+
Err(e) => return Err(e),
1105+
}
10971106
log.record(sig_value, action_kind, explicit);
10981107

10991108
// Set environment variable to communicate to Rust child processes

0 commit comments

Comments
 (0)