Set GPG_TTY for terminal sessions

This commit is contained in:
lachtan obecny
2026-11-04 11:13:29 +01:00
parent 51fdde4e2c
commit 60475d9c57
3 changed files with 11 additions and 0 deletions
+1
View File
@@ -21,6 +21,7 @@ and adds `bin/` to PATH. `$LWS` points to repo root.
- `can_run <cmd>` — check if command is available
- `is_slow_init` / `is_fast_init` — check `LWS_FAST` mode
- `is_interactive_shell` — true when `[[ $- == *i* ]]`
- `is_stdin_terminal` — true when stdin is a terminal (`tty` would return a device, not `not a tty`)
- `is_wsl` — detect WSL environment
- `is_ssh_session` — true when logged in over SSH
- `true_false <val>` — normalize `1/true/yes` to boolean
+4
View File
@@ -9,6 +9,10 @@ function is_interactive_shell() {
[[ $- == *i* ]]
}
function is_stdin_terminal() {
[[ -t 0 ]]
}
function is_fast_init() {
(( $LWS_FAST ))
}
+6
View File
@@ -0,0 +1,6 @@
# shellcheck shell=bash
if is_stdin_terminal && can_run gpg; then
GPG_TTY=$(tty)
export GPG_TTY
fi