Make entrypoint RubyMine compatible.#3
Make entrypoint RubyMine compatible.#3cleverer wants to merge 1 commit intonxt-engineering:masterfrom
Conversation
|
|
||
| # shellcheck disable=SC2068 | ||
| exec bundle exec $@ | ||
| exec bundle exec "$@" |
There was a problem hiding this comment.
🤔 It was intentionally not quoted. Calling the script like .docker/entrypoint somecommand -with -some -arguments would result in a command like that:
exec bundle exec "somecommand -with -some -arguments"I.e. bash won't split the string into multiple arguments, but pass it as one argument. Bundler would see the following arguments:
arg[0] = 'bundle'
arg[1] = 'exec'
arg[2] = 'somecommand -with -some -arguments'
Rather than without the quotes:
arg[0] = 'bundle'
arg[1] = 'exec'
arg[2] = 'somecommand'
arg[3] = '-with'
arg[4] = '-some'
arg[5] = '-arguments'
I'm not sure if the proposed change achieves what is intended.
There was a problem hiding this comment.
I tried it just now in various quoting combinations, it works just fine like that (e.g. docker-compose run --rm app rails c and docker-compose run --rm app --keep-file-descriptors rails c gives me the rails shell). I think the first exec splits the arguments again, but couldn't find any documentation on it.
Without the quotes, RubyMine gets stuck at
Handing control over to 'sh -c /usr/local/bin/ruby /app/hitobito/bin/rails server -b 0.0.0.0 -p 3000 -e development''Make entrypoint RubyMine compatible
Launch command wasn't escaped properly…