Skip to content

Commit

Permalink
Don't require absolute path with --daemon
Browse files Browse the repository at this point in the history
  • Loading branch information
kou committed May 29, 2014
1 parent 243f8cd commit e2ef3ab
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
16 changes: 12 additions & 4 deletions lib/droonga/command/droonga_engine.rb
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,14 @@ def parse_command_line_arguments!(command_line_arguments)

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
Expand Down Expand Up @@ -185,7 +193,7 @@ def add_log_options(parser)
end
parser.on("--log-file=FILE",
"Output logs to FILE") do |file|
@log_file = file
@log_file = File.expand_path(file)
end
end

Expand All @@ -198,7 +206,7 @@ def add_process_options(parser)
end
parser.on("--pid-file=FILE",
"Put PID to the FILE") do |file|
@pid_file = file
@pid_file = File.expand_path(file)
end
end

Expand All @@ -208,7 +216,7 @@ def add_path_options(parser)
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

Expand Down Expand Up @@ -348,7 +356,7 @@ def run
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,
Expand Down
2 changes: 1 addition & 1 deletion lib/droonga/serf.rb
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ def start
@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
Expand Down

0 comments on commit e2ef3ab

Please sign in to comment.