mirror of
https://github.com/fish-shell/fish-shell.git
synced 2026-06-18 03:41:16 -03:00
Add $fish_kill_signal to track the signal that terminated a command.
Set to `0` if the command exited normally.
This commit is contained in:
committed by
Johannes Altmanninger
parent
67eaefeb82
commit
61a9cdaa74
@@ -93,6 +93,7 @@ static const electric_var_t electric_variables[] = {
|
||||
{L"_", electric_var_t::freadonly},
|
||||
{L"fish_private_mode", electric_var_t::freadonly},
|
||||
{L"umask", electric_var_t::fcomputed},
|
||||
{L"fish_kill_signal", electric_var_t::freadonly | electric_var_t::fcomputed},
|
||||
};
|
||||
|
||||
const electric_var_t *electric_var_t::for_name(const wcstring &name) {
|
||||
@@ -685,6 +686,9 @@ maybe_t<env_var_t> env_scoped_impl_t::try_get_computed(const wcstring &key) cons
|
||||
} else if (key == L"status") {
|
||||
const auto &js = perproc_data().statuses;
|
||||
return env_var_t(L"status", to_string(js.status));
|
||||
} else if (key == L"fish_kill_signal") {
|
||||
const auto &js = perproc_data().statuses;
|
||||
return env_var_t(L"fish_kill_signal", to_string(js.kill_signal));
|
||||
} else if (key == L"umask") {
|
||||
// note umask() is an absurd API: you call it to set the value and it returns the old
|
||||
// value. Thus we have to call it twice, to reset the value. The env_lock protects
|
||||
|
||||
Reference in New Issue
Block a user