Skip to content

Commit 002415b

Browse files
committed
fix(env): skip uncatchable signals on OpenBSD when applying to all signals
1 parent c72649d commit 002415b

2 files changed

Lines changed: 11 additions & 1 deletion

File tree

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -279,3 +279,4 @@ Nofile
279279
rprocess
280280
statat
281281
getdents
282+
SIGTHR

src/uu/env/src/env.rs

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

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

0 commit comments

Comments
 (0)