Fix: replace find|while pipe with process substitution in perform_update() and main script

This fixes the issue where cp and mkdir in the while loop were running in a subshell
due to pipe usage, preventing proper error propagation with 'set -euo pipefail'.
Using process substitution ensures the while loop runs in the main process.
This commit is contained in:
Hermes Agent
2026-06-04 08:04:03 +02:00
parent c4775ca99e
commit 7eac6b7dba
+4 -6
View File
@@ -250,13 +250,12 @@ perform_update() {
if [ -d "$script_dir/plugin" ]; then if [ -d "$script_dir/plugin" ]; then
# Lösche vorherige Dateien NICHT — das könnte andere Submodule zerstören # Lösche vorherige Dateien NICHT — das könnte andere Submodule zerstören
# Kopiere ALLE Dateien aus plugin/ rekursiv (behält Struktur) # Kopiere ALLE Dateien aus plugin/ rekursiv (behält Struktur)
find "$script_dir/plugin" -type f ! -path '*/__pycache__/*' ! -name '*.pyc' \ while read -r src; do
| while read -r src; do
rel="${src#$script_dir/plugin/}" rel="${src#$script_dir/plugin/}"
dst="$PLUGIN_DST/$rel" dst="$PLUGIN_DST/$rel"
mkdir -p "$(dirname "$dst")" mkdir -p "$(dirname "$dst")"
cp "$src" "$dst" cp "$src" "$dst"
done done < <(find "$script_dir/plugin" -type f ! -path '*/__pycache__/*' ! -name '*.pyc')
copied_count=$(find "$script_dir/plugin" -type f ! -path '*/__pycache__/*' ! -name '*.pyc' | wc -l) copied_count=$(find "$script_dir/plugin" -type f ! -path '*/__pycache__/*' ! -name '*.pyc' | wc -l)
msg copied "$copied_count" msg copied "$copied_count"
fi fi
@@ -488,13 +487,12 @@ mkdir -p "$PLUGIN_DST"
if [ -d "$SCRIPT_DIR/plugin" ]; then if [ -d "$SCRIPT_DIR/plugin" ]; then
# Lösche vorherige Dateien NICHT — das könnte andere Submodule zerstören # Lösche vorherige Dateien NICHT — das könnte andere Submodule zerstören
# Kopiere ALLE Dateien aus plugin/ rekursiv (behält Struktur) # Kopiere ALLE Dateien aus plugin/ rekursiv (behält Struktur)
find "$SCRIPT_DIR/plugin" -type f ! -path '*/__pycache__/*' ! -name '*.pyc' \ while read -r src; do
| while read -r src; do
rel="${src#$SCRIPT_DIR/plugin/}" rel="${src#$SCRIPT_DIR/plugin/}"
dst="$PLUGIN_DST/$rel" dst="$PLUGIN_DST/$rel"
mkdir -p "$(dirname "$dst")" mkdir -p "$(dirname "$dst")"
cp "$src" "$dst" cp "$src" "$dst"
done done < <(find "$SCRIPT_DIR/plugin" -type f ! -path '*/__pycache__/*' ! -name '*.pyc')
copied_count=$(find "$SCRIPT_DIR/plugin" -type f ! -path '*/__pycache__/*' ! -name '*.pyc' | wc -l) copied_count=$(find "$SCRIPT_DIR/plugin" -type f ! -path '*/__pycache__/*' ! -name '*.pyc' | wc -l)
msg copied "$copied_count" msg copied "$copied_count"
fi fi