diff options
author | bronzdoc <lsagastume1990@gmail.com> | 2016-10-30 08:56:25 -0600 |
---|---|---|
committer | bronzdoc <lsagastume1990@gmail.com> | 2016-10-30 09:03:42 -0600 |
commit | 909979271a0c2fe0d59f6fc8c4f5a630e597f1ac (patch) | |
tree | d18b5d0e0e7e32ae82b4b7fab103817a677e5830 /lib/bundler/cli | |
parent | 7327dc59476c79547170d3ef8162f24b3aea385f (diff) | |
download | bundler-909979271a0c2fe0d59f6fc8c4f5a630e597f1ac.tar.gz |
Warn if executable in bundle exec is empty
Diffstat (limited to 'lib/bundler/cli')
-rw-r--r-- | lib/bundler/cli/exec.rb | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/lib/bundler/cli/exec.rb b/lib/bundler/cli/exec.rb index 4f238bbb59..62f7bc26cb 100644 --- a/lib/bundler/cli/exec.rb +++ b/lib/bundler/cli/exec.rb @@ -91,6 +91,12 @@ module Bundler "#!/usr/bin/env jruby\n", "#!#{Gem.ruby}\n", ] + + if File.zero?(file) + Bundler.ui.warn "#{file} is empty" + return false + end + first_line = File.open(file, "rb") {|f| f.read(possibilities.map(&:size).max) } possibilities.any? {|shebang| first_line.start_with?(shebang) } end |