[Groonga-commit] droonga/droonga-engine at 4a47f48 [master] Don't exit by command implementation itself

Back to archive index

YUKI Hiroshi null+****@clear*****
Wed Apr 15 17:13:09 JST 2015


YUKI Hiroshi	2015-04-15 17:13:09 +0900 (Wed, 15 Apr 2015)

  New Revision: 4a47f48710538cecd265ae7e6ef6b1b922e18676
  https://github.com/droonga/droonga-engine/commit/4a47f48710538cecd265ae7e6ef6b1b922e18676

  Message:
    Don't exit by command implementation itself

  Modified files:
    bin/droonga-engine-absorb-data
    bin/droonga-engine-join

  Modified: bin/droonga-engine-absorb-data (+2 -2)
===================================================================
--- bin/droonga-engine-absorb-data    2015-04-15 16:54:15 +0900 (1ed8cb8)
+++ bin/droonga-engine-absorb-data    2015-04-15 17:13:09 +0900 (eabc666)
@@ -47,7 +47,7 @@ module Droonga
       succeeded = absorb
 
       puts "Done." if succeeded
-      exit(succeeded)
+      succeeded
     end
 
     private
@@ -268,4 +268,4 @@ module Droonga
   end
 end
 
-Droonga::AbsorbDataCommand.new.run
+exit(Droonga::AbsorbDataCommand.new.run)

  Modified: bin/droonga-engine-join (+8 -5)
===================================================================
--- bin/droonga-engine-join    2015-04-15 16:54:15 +0900 (7ecb8af)
+++ bin/droonga-engine-join    2015-04-15 17:13:09 +0900 (7ef7cd7)
@@ -34,6 +34,9 @@ require "droonga/node_metadata"
 
 module Droonga
   class JoinCommand
+    class MissingRequiredParameter < StandardError
+    end
+
     def run
       @loop = Coolio::Loop.default
 
@@ -59,20 +62,20 @@ module Droonga
           successed = copy_data
           unless successed
             do_cancel
-            exit(false)
+            return false
           end
         end
         set_effective_message_timestamp
         reset_source_node_role
         reset_joining_node_role
         puts("Done.")
+        true
       rescue Exception => exception
         puts("Unexpected exception: #{exception.message}")
         puts(exception.backtrace.join("\n"))
         do_cancel
-        exit(false)
+        false
       end
-      exit(true)
     end
 
     private
@@ -121,7 +124,7 @@ module Droonga
       @options = options
     rescue Slop::MissingOptionError => error
       $stderr.puts(error)
-      exit(false)
+      raise MissingRequiredParameter.new
     end
 
     def dataset
@@ -336,4 +339,4 @@ module Droonga
   end
 end
 
-Droonga::JoinCommand.new.run
+exit(Droonga::JoinCommand.new.run)
-------------- next part --------------
HTML����������������������������...
Descargar 



More information about the Groonga-commit mailing list
Back to archive index