From: "evilensky (Eugene Vilensky)" <evilensky@...>
Date: 2013-10-09T04:50:15+09:00
Subject: [ruby-core:57739] [ruby-trunk - Bug #9004] gem which command should	exit with status of '1' if 1 or more gem arguments are not found


Issue #9004 has been updated by evilensky (Eugene Vilensky).


Apologies for breaking the formatting of Description.


rpm case

# rpm -q man
man-1.6f-32.el6.x86_64
# echo $?
0
# rpm -q man cheese
man-1.6f-32.el6.x86_64
package cheese is not installed
# echo $?
1
gem which case

$ gem which capistrano
/opt/boxen/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/capistrano-2.15.5/lib/capistrano.rb
evilensky@Vilensky~/src/puppet/lib/puppet (add-yum-uninstall-to-yum-provider)$ echo $?
0
$ gem which capistrano rails
/opt/boxen/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/capistrano-2.15.5/lib/capistrano.rb
ERROR:  Can't find ruby library file or shared library rails
$ echo $?
0

----------------------------------------
Bug #9004: gem which command should exit with status of '1' if 1 or more gem arguments are not found
https://bugs.ruby-lang.org/issues/9004#change-42342

Author: evilensky (Eugene Vilensky)
Status: Open
Priority: Low
Assignee: 
Category: 
Target version: 
ruby -v: ruby 1.9.3p448 (2013-06-27 revision 41675) [x86_64-darwin12.4.0]
Backport: 1.9.3: UNKNOWN, 2.0.0: UNKNOWN


Many unix utilities exit with a code of 1 if any parts of the command fail, in particular `rpm`.  I believe its desirable for `gem which` to behave similar to `rpm -q` for this use case.


(({# rpm -q man
man-1.6f-32.el6.x86_64
# echo $?
0}))



(({# rpm -q man cheese
man-1.6f-32.el6.x86_64
package cheese is not installed
# echo $?
1}))

(({$ gem which capistrano
/opt/boxen/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/capistrano-2.15.5/lib/capistrano.rb
evilensky@Vilensky~/src/puppet/lib/puppet (add-yum-uninstall-to-yum-provider)$ echo $?
0}))

(({$ gem which capistrano rails
/opt/boxen/rbenv/versions/1.9.3-p448/lib/ruby/gems/1.9.1/gems/capistrano-2.15.5/lib/capistrano.rb
ERROR:  Can't find ruby library file or shared library rails
$ echo $?
0}))


-- 
http://bugs.ruby-lang.org/