Skip to content

Commit

Permalink
Detect ruby engine
Browse files Browse the repository at this point in the history
  • Loading branch information
jordansissel committed Jun 4, 2013
1 parent 9e0f981 commit 95ba70d
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions bin/logstash
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

basedir=$(cd `dirname $0`/..; pwd)
if [ -d "$basedir/.git" ] ; then
RUBY=${RUBY=jruby}
RUBY=${RUBY=$(ruby -e 'puts RUBY_ENGINE')}
RUBYVER=${RUBYVER=1.9}
export GEM_HOME="$basedir/vendor/bundle/${RUBY}/${RUBYVER}"
export GEM_PATH=
Expand All @@ -12,10 +12,10 @@ export RUBYLIB="$basedir/lib"

which ruby > /dev/null 2>&1
if [ "$?" -eq 0 -a -z "$USE_JRUBY" ] ; then
ruby "$basedir/lib/logstash/runner.rb" "$@"
exec ruby "$basedir/lib/logstash/runner.rb" "$@"
else
# No ruby found, fetch JRuby and run.
jruby="vendor/jar/jruby-complete-1.7.3.jar"
[ ! -f "$jruby" ] && make build-jruby
java -jar "$jruby" "$basedir/lib/logstash/runner.rb" "$@"
exec java -jar "$jruby" "$basedir/lib/logstash/runner.rb" "$@"
fi

0 comments on commit 95ba70d

Please sign in to comment.