On Mon, Oct 11, 2010 at 1:23 PM, Jacob Helwig <[email protected]> wrote:

> Re-add the "exit" lost in f4da528.  Both sides of the original merge had
> the explicit exit in the success case around RDoc.usage.
>
> Signed-off-by: Jacob Helwig <[email protected]>
> ---
>
> Rein,
>
> Sorry for taking so long to get this off to you.
>
> From looking at
> dce8f5727c4b6ee0332500c189775cc7c036e6d0^1:lib/facter/application.rb
> and
> dce8f5727c4b6ee0332500c189775cc7c036e6d0^2:lib/facter/application.rb
> it looks like the exit should have been left there.
>
> If that's not the case, though, just let me know.
>
> Available at:
>
> git://github.com/jhelwig/facter.git testing
>
>  lib/facter/application.rb |    1 +
>  1 files changed, 1 insertions(+), 0 deletions(-)
>
> diff --git a/lib/facter/application.rb b/lib/facter/application.rb
> index 9de9249..6c5b1dd 100644
> --- a/lib/facter/application.rb
> +++ b/lib/facter/application.rb
> @@ -73,6 +73,7 @@ module Facter
>             require 'rdoc/ri/ri_paths'
>             require 'rdoc/usage'
>             puts RDoc.usage
> +            exit
>           rescue LoadError
>             $stderr.puts "No help available unless your RDoc has
> RDoc.usage"
>             exit(1)
> --
> 1.7.3.1
>

Reading this code, it looks like RDoc.usage returns the usage string.
 Actually, what it does is print the usage string and exit.  (This is
obliquely hinted at in the documentation--see
http://ruby-doc.org/core/classes/RDoc.html#M004706, and I've verified it by
experiment).  As a result, the code above works by accident, with or without
the "exit" statement.  To avoid future confusion perhaps it would be better
to do something like this:

diff --git a/lib/facter/application.rb b/lib/facter/application.rb
index 9de9249..56827ec 100644
--- a/lib/facter/application.rb
+++ b/lib/facter/application.rb
@@ -72,7 +72,7 @@ module Facter
           begin
             require 'rdoc/ri/ri_paths'
             require 'rdoc/usage'
-            puts RDoc.usage
+            RDoc.usage # print usage and exit
           rescue LoadError
             $stderr.puts "No help available unless your RDoc has
RDoc.usage"
             exit(1)

-- 
You received this message because you are subscribed to the Google Groups 
"Puppet Developers" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/puppet-dev?hl=en.

Reply via email to