shogi-server source
Revisão | f578431c0b279b436c5a537d6a61802d475690d7 (tree) |
---|---|
Hora | 2018-08-26 09:14:48 |
Autor | Daigo Moriwaki <daigo@debi...> |
Commiter | Daigo Moriwaki |
[shogi-server] Create a directory for a PID file. (Closes #38546)
To put a PID file such as /var/run/shogi-server/shogi-server.pid, if
directories do not exist, they will be created recursively.
@@ -4,6 +4,10 @@ | ||
4 | 4 | A file named "STOP" in the base directory prevents the server from |
5 | 5 | starting new games including Floodgate matches. |
6 | 6 | (Closes #38544) |
7 | + * [shogi-server] Create a directory for a PID file. | |
8 | + To put a PID file such as /var/run/shogi-server/shogi-server.pid, if | |
9 | + directories do not exist, they will be created recursively. | |
10 | + (Closes #38546) | |
7 | 11 | |
8 | 12 | 2018-04-07 Daigo Moriwaki <daigo at debian dot org> |
9 | 13 |
@@ -34,6 +34,7 @@ require 'shogi_server' | ||
34 | 34 | require 'shogi_server/config' |
35 | 35 | require 'shogi_server/util' |
36 | 36 | require 'shogi_server/league/floodgate_thread.rb' |
37 | +require 'pathname' | |
37 | 38 | require 'tempfile' |
38 | 39 | |
39 | 40 | ################################################# |
@@ -271,6 +272,8 @@ def check_command_line | ||
271 | 272 | |
272 | 273 | if $options["pid-file"] |
273 | 274 | $options["pid-file"] = File.expand_path($options["pid-file"], $topdir) |
275 | + path = Pathname.new($options["pid-file"]) | |
276 | + path.dirname().mkpath() | |
274 | 277 | unless ShogiServer::is_writable_file? $options["pid-file"] |
275 | 278 | usage |
276 | 279 | $stderr.puts "Can not create the pid file: %s" % [$options["pid-file"]] |