Skip to content

Commit 0ab7479

Browse files
committed
fix(env): skip uncatchable signals on OpenBSD when applying to all signals
1 parent 7265a11 commit 0ab7479

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
@@ -1080,7 +1080,16 @@ where
10801080
let Ok(sig) = signal_from_value(sig_value) else {
10811081
return Ok(());
10821082
};
1083-
signal_fn(sig)?;
1083+
match signal_fn(sig) {
1084+
Ok(()) => {}
1085+
Err(_) if !explicit => {
1086+
// When applying to all signals, silently skip signals that
1087+
// the OS refuses to change (e.g. SIGTHR on OpenBSD).
1088+
// GNU env also ignores these.
1089+
return Ok(());
1090+
}
1091+
Err(e) => return Err(e),
1092+
}
10841093
log.record(sig_value, action_kind, explicit);
10851094

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

0 commit comments

Comments
 (0)