From 65bf99c5793ff83436fa65f64c4cdd874cdb4ebc Mon Sep 17 00:00:00 2001 From: meck Date: Tue, 28 Oct 2025 16:35:02 +0100 Subject: [PATCH] yazi: update wrappers not to use cat in subshell If cat is aliased to bat the non piping operation in the script might include extra text, use builtins instead --- modules/programs/yazi.nix | 4 ++-- tests/modules/programs/yazi/fish-integration-expected.fish | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/modules/programs/yazi.nix b/modules/programs/yazi.nix index c945447cd..6d8dbe0fb 100644 --- a/modules/programs/yazi.nix +++ b/modules/programs/yazi.nix @@ -221,7 +221,7 @@ in function ${cfg.shellWrapperName}() { local tmp="$(mktemp -t "yazi-cwd.XXXXX")" yazi "$@" --cwd-file="$tmp" - if cwd="$(cat -- "$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then + if cwd="$(<"$tmp")" && [ -n "$cwd" ] && [ "$cwd" != "$PWD" ]; then builtin cd -- "$cwd" fi rm -f -- "$tmp" @@ -231,7 +231,7 @@ in fishIntegration = '' set -l tmp (mktemp -t "yazi-cwd.XXXXX") command yazi $argv --cwd-file="$tmp" - if set cwd (cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ] + if read cwd < "$tmp"; and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ] builtin cd -- "$cwd" end rm -f -- "$tmp" diff --git a/tests/modules/programs/yazi/fish-integration-expected.fish b/tests/modules/programs/yazi/fish-integration-expected.fish index d8f11f284..d0019d999 100644 --- a/tests/modules/programs/yazi/fish-integration-expected.fish +++ b/tests/modules/programs/yazi/fish-integration-expected.fish @@ -1,7 +1,7 @@ function yy set -l tmp (mktemp -t "yazi-cwd.XXXXX") command yazi $argv --cwd-file="$tmp" - if set cwd (cat -- "$tmp"); and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ] + if read cwd <"$tmp"; and [ -n "$cwd" ]; and [ "$cwd" != "$PWD" ] builtin cd -- "$cwd" end rm -f -- "$tmp"