Skip to content

Commit 42458d8

Browse files
authored
Merge pull request #956 from tfendin/xargs-conflicting-args
2 parents 760428f + b2794c1 commit 42458d8

File tree

1 file changed

+7
-20
lines changed

1 file changed

+7
-20
lines changed

bin/git-effort

Lines changed: 7 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -203,28 +203,15 @@ export columns
203203
hide_cursor
204204
trap show_cursor_and_cleanup INT
205205

206-
# export functions so subshells can call them
207-
export -f effort
208-
export -f color_for
209-
export -f active_days
210-
export -f dates
211-
export -f tputq
212-
export to_tty
213-
export above
214-
export log_args
215-
216-
217-
bash_params=
218-
# If bash exits successfully with --import-functions,
219-
# then we need to pass it (FreeBSD probably)
220-
bash --import-functions -c ":" 1>/dev/null 2>&1
221-
if [ $? -eq 0 ] ; then
222-
bash_params="--import-functions"
223-
fi
224-
225206
heading
207+
226208
# send paths to effort
227-
printf "%s\0" "${paths[@]}" | xargs -0 -n 1 -P 4 -I % bash $bash_params -c "effort \"%\"" | tee $tmp
209+
nPaths=${#paths[@]}
210+
for ((i=0; i<nPaths; ++i))
211+
do
212+
effort "${paths[i]}" &
213+
done|tee $tmp
214+
wait
228215

229216
# if more than one path, sort and print
230217
test "$(wc -l $tmp | awk '{print $1}')" -gt 1 && sort_effort

0 commit comments

Comments
 (0)