Skip to content

Commit 307bb9c

Browse files
EarnestlyAladW
authored andcommitted
fetch: use pipes and command groups
It appeared that trurl was reading stdin before cat and so corrupting the inputs to the outer while loop. Instead of a well formed "remote path" format it would see http://nx/ / and http://samsung-unified-driver/ /. Using pipes and command groups seems to address this problem. aurutils#1230 (comment) Fixes aurutils#1230
1 parent 5a07ad6 commit 307bb9c

File tree

1 file changed

+11
-13
lines changed

1 file changed

+11
-13
lines changed

lib/aurweb/aur-fetch

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -144,8 +144,15 @@ while read -r remote path; do
144144

145145
packages["$pkgbase"]=$remote
146146
done < <(
147-
# Look ma, no pipes.
148-
trurl --get '{url} {path}' --url-file - < <(
147+
{
148+
if (( recurse )); then
149+
aur depends --reverse "$@" | tsort
150+
elif [[ $# = 1 && $1 = - || $1 = /dev/stdin ]]; then
151+
cat
152+
else
153+
printf '%s\n' "$@"
154+
fi
155+
} | {
149156
while IFS= read -r pkg; do
150157
if [[ $pkg != *://* ]]; then
151158
printf '%s/%s\n' "$AUR_LOCATION" "$pkg"
@@ -154,17 +161,8 @@ done < <(
154161
else
155162
printf '%s\n' "$pkg"
156163
fi
157-
printf '%s\n' "$pkg"
158-
done < <(
159-
if (( recurse )); then
160-
aur depends --reverse "$@" | tsort
161-
elif [[ $# = 1 && $1 = - || $1 = /dev/stdin ]]; then
162-
cat
163-
else
164-
printf '%s\n' "$@"
165-
fi
166-
)
167-
)
164+
done
165+
} | trurl --get '{url} {path}' --url-file -
168166
)
169167
wait "$!" || exit
170168

0 commit comments

Comments
 (0)