[Groonga-commit] droonga/droonga-engine at e2ef3ab [master] Don't require absolute path with --daemon

Back to archive index

Kouhei Sutou null+****@clear*****
Thu May 29 16:25:05 JST 2014


Kouhei Sutou	2014-05-29 16:25:05 +0900 (Thu, 29 May 2014)

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

  Message:
    Don't require absolute path with --daemon

  Modified files:
    lib/droonga/command/droonga_engine.rb
    lib/droonga/serf.rb

  Modified: lib/droonga/command/droonga_engine.rb (+12 -4)
===================================================================
--- lib/droonga/command/droonga_engine.rb    2014-05-29 16:14:49 +0900 (d731530)
+++ lib/droonga/command/droonga_engine.rb    2014-05-29 16:25:05 +0900 (205b29b)
@@ -64,6 +64,14 @@ module Droonga
 
       def ensure_path
         Path.base
+        unless $0 == File.basename($0)
+          droonga_engine_bin_path = File.expand_path(File.dirname($0))
+          new_paths = [
+            droonga_engine_bin_path,
+            ENV["PATH"],
+          ]
+          ENV["PATH"] = new_paths.join(File::PATH_SEPARATOR)
+        end
       end
 
       def run_main_loop
@@ -185,7 +193,7 @@ module Droonga
           end
           parser.on("--log-file=FILE",
                     "Output logs to FILE") do |file|
-            @log_file = file
+            @log_file = File.expand_path(file)
           end
         end
 
@@ -198,7 +206,7 @@ module Droonga
           end
           parser.on("--pid-file=FILE",
                     "Put PID to the FILE") do |file|
-            @pid_file = file
+            @pid_file = File.expand_path(file)
           end
         end
 
@@ -208,7 +216,7 @@ module Droonga
           parser.on("--base-dir=DIR",
                     "Use DIR as the base directory",
                     "(#{Path.base})") do |dir|
-            Path.base = dir
+            Path.base = File.expand_path(dir)
           end
         end
 
@@ -348,7 +356,7 @@ module Droonga
           command_line = [
             RbConfig.ruby,
             "-S",
-            "#{$0}-service",
+            "droonga-engine-service",
             "--listen-fd", listen_fd.to_s,
             "--heartbeat-fd", heartbeat_fd.to_s,
             "--control-read-fd", control_write_in.fileno.to_s,

  Modified: lib/droonga/serf.rb (+1 -1)
===================================================================
--- lib/droonga/serf.rb    2014-05-29 16:14:49 +0900 (88262ad)
+++ lib/droonga/serf.rb    2014-05-29 16:25:05 +0900 (6ed72ee)
@@ -46,7 +46,7 @@ module Droonga
       @pid = run("agent",
                  "-node", @name,
                  "-bind", extract_host(@name),
-                 "-event-handler", "#{$0}-serf-event-handler",
+                 "-event-handler", "droonga-engine-serf-event-handler",
                  *retry_joins)
       logger.trace("start: done")
     end
-------------- next part --------------
HTML����������������������������...
下载 



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