commit 72d1ee452da11f9365d0a2f3ba6b7a1af3310b83
parent 585c86ff9340ee3e9918e340743f96e8c8c0787f
Author: Szymon Mikulicz <szymon.mikulicz@posteo.net>
Date: Thu, 21 May 2026 13:03:17 +0200
Fix withenv
Diffstat:
2 files changed, 18 insertions(+), 8 deletions(-)
diff --git a/scripts/.local/bin/withenv b/scripts/.local/bin/withenv
@@ -1,8 +1,18 @@
#!/bin/sh
+
if [ "$1" = "--export" ]; then
awk '{print "export \"" $0 "\""}' "$2"
-else
- ENVFILE="$1"
- shift
- exec env "$(envsubst < "$ENVFILE")" "$@"
+ exit 0
fi
+
+ENVFILE="$1"
+shift
+fifo="$(mktemp -d)/fifo"
+mkfifo "$fifo"
+(
+ envsubst < "$ENVFILE" | tr '\n' '\0'
+ printf "%s\0" "$@"
+ rm -rf "$(dirname "$fifo")"
+) >> "$fifo" &
+
+exec xargs -0 -a "$fifo" env
diff --git a/zsh/.zshenv b/zsh/.zshenv
@@ -1,5 +1,9 @@
skip_global_compinit=1
+if [[ $SWAY_ENV != 1 ]]; then
+ source <(~/.local/bin/withenv --export ~/.config/sway/env)
+fi
+
export MISE_Found="$(which mise &>/dev/null; echo $?)"
tools=( 'vivid' 'nvim' )
declare -A tool_paths
@@ -15,10 +19,6 @@ done
[ -n "${tool_paths[nvim]}" ] && export EDITOR="${tool_paths[nvim]}" && export SUDO_EDITOR="$EDITOR"
[ -n "${tool_paths[vivid]}" ] && export LS_COLORS="$(${tool_paths[vivid]} generate rose-pine-moon)"
-if [[ $SWAY_ENV != 1 ]]; then
- source <(withenv --export ~/.config/sway/env)
-fi
-
export PERL5LIB="$HOME/.usr/local/lib/perl5/"
[ -f "$XDG_RUNTIME_DIR/arista-ssh/agent.sock" ] && export SSH_AUTH_SOCK="$XDG_RUNTIME_DIR/arista-ssh/agent.sock"
export ZSH_EXEC=1