mirror of
https://github.com/nix-community/home-manager.git
synced 2024-12-14 11:57:55 +00:00
direnv: update for new nushell behavior (#5880)
Nushell 0.98 makes it so external commands returning non-zero is considered an exception[0]. Wrap the direnv invocation in a try-catch, so that even if direnv fails, we get the message from direnv, but not the traceback from nushell. [0]: https://www.nushell.sh/blog/2024-09-17-nushell_0_98_0.html#non-zero-exit-codes-are-now-errors-toc
This commit is contained in:
parent
21c021862f
commit
1e22ef1518
2 changed files with 10 additions and 4 deletions
|
@ -140,9 +140,15 @@ in {
|
||||||
$env.config.hooks.pre_prompt?
|
$env.config.hooks.pre_prompt?
|
||||||
| default []
|
| default []
|
||||||
| append {||
|
| append {||
|
||||||
let direnv = (${getExe cfg.package} export json
|
let direnv = (
|
||||||
| from json
|
try {
|
||||||
| default {})
|
${getExe cfg.package} export json
|
||||||
|
} catch {
|
||||||
|
""
|
||||||
|
}
|
||||||
|
| from json
|
||||||
|
| default {}
|
||||||
|
)
|
||||||
if ($direnv | is-empty) {
|
if ($direnv | is-empty) {
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,6 +14,6 @@
|
||||||
in ''
|
in ''
|
||||||
assertFileExists "${configFile}"
|
assertFileExists "${configFile}"
|
||||||
assertFileRegex "${configFile}" \
|
assertFileRegex "${configFile}" \
|
||||||
'^\s*let direnv = (/nix/store/.*direnv.*/bin/direnv export json$'
|
'^\s*/nix/store/.*direnv.*/bin/direnv export json$'
|
||||||
'';
|
'';
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue