jordansissel/fpm — pull request #341 by xiongchiamiov (2013-01-16 02:10:14+00:00)
Title: Fix error return code on Ruby 1.8. (#338)

--before-install (and its brethren) were not causing fpm to exit on a
non-existant file error when using Ruby 1.8.

The root of the problem appears to be that that particular error-checking is
done inside a proc (lib/fpm/command.rb#L374); in Ruby 1.9, the return value of
the proc is used to determine whether `#call` was successful, while 1.8
gleefully ignores it.

[$]> cat test.rb
test = proc do
return 1
end

test.call

[$]> ruby-1.8.7-p334 test.rb; echo $?
0

[$]> ruby-1.9.3-p125 test.rb; echo $?
test.rb:2:in `block in

': unexpected return (LocalJumpError)
from test.rb:5:in `call'
from test.rb:5:in `

'
1

In this instance, we can use `exit` instead of `return`, and that'll be fine.