Skip to content

Commit 567853e

Browse files
authored
Fixes shellcheck SC2144
Currently, this code only works if there is only one match. If for any reason there will be more than one, it'll fail. See https://github.com/koalaman/shellcheck/wiki/SC2144
1 parent 10924d3 commit 567853e

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

railties/lib/rails/generators/rails/app/templates/docker-entrypoint.tt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,17 @@
11
#!/bin/bash -e
22

33
# Enable jemalloc for reduced memory usage and latency.
4-
if [ -z "${LD_PRELOAD+x}" ] && [ -f /usr/lib/*/libjemalloc.so.2 ]; then
5-
export LD_PRELOAD="$(echo /usr/lib/*/libjemalloc.so.2)"
4+
jemalloc_found=false
5+
for lib in /usr/lib/*/libjemalloc.so.2; do
6+
if [ -f "$lib" ]; then
7+
export LD_PRELOAD="$lib"
8+
jemalloc_found=true
9+
break
10+
fi
11+
done
12+
13+
if [ "$jemalloc_found" = false ]; then
14+
echo "Warning: jemalloc not found"
615
fi
716

817
<% unless skip_active_record? -%>

0 commit comments

Comments
 (0)