mirror of
https://github.com/nix-community/home-manager.git
synced 2026-10-30 16:10:45 +00:00
gpg-agent: don't abort nushell startup when tty is unavailable
The nushell integration set $env.GPG_TTY = (tty) unconditionally. Unlike the bash/zsh/fish variants, which use a plain command substitution and silently continue with an empty value on failure, nushell aborts the whole script when an external command used as an expression value exits non-zero. A missing controlling terminal (e.g. a login shell invoked non-interactively, such as by WSL's generated Windows app launchers) made nu exit immediately, breaking every command run through that login shell. Wrap the call in try/catch so nushell degrades the same way the other shell integrations do.
This commit is contained in:
committed by
Austin Horstman
parent
5d5f3e51a3
commit
2cd3234928
@@ -44,7 +44,7 @@ let
|
||||
'';
|
||||
|
||||
gpgNushellInitStr = ''
|
||||
$env.GPG_TTY = (tty)
|
||||
$env.GPG_TTY = (try { tty } catch { "" })
|
||||
''
|
||||
+ optionalString cfg.enableSshSupport ''
|
||||
${gpgSshSupportStr} | ignore
|
||||
|
||||
@@ -19,6 +19,9 @@
|
||||
assertFileContains \
|
||||
home-files/.config/nushell/config.nu \
|
||||
'$env.SSH_AUTH_SOCK = $"(@gnupg@/bin/gpgconf --list-dirs agent-ssh-socket)"'
|
||||
assertFileContains \
|
||||
home-files/.config/nushell/config.nu \
|
||||
'$env.GPG_TTY = (try { tty } catch { "" })'
|
||||
assertFileContains \
|
||||
home-files/.zshenv \
|
||||
'export SSH_AUTH_SOCK="$(@gnupg@/bin/gpgconf --list-dirs agent-ssh-socket)"'
|
||||
|
||||
Reference in New Issue
Block a user