rake_server 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.0.6
1
+ 0.0.7
@@ -14,6 +14,16 @@ module RakeServer
14
14
  class <<self
15
15
  def start(eager_tasks, options = {})
16
16
  pid_file = File.join(pid_dir(options), "rake-server.pid")
17
+ if File.exist?(pid_file)
18
+ running_pid = IO.read(pid_file).to_i
19
+ begin
20
+ Process.kill(0, running_pid)
21
+ raise "rake-server is already running on PID #{running_pid}"
22
+ rescue Errno::ESRCH
23
+ STDERR.puts("Cleaning stale PID file at #{pid_file}")
24
+ FileUtils.rm_f(pid_file)
25
+ end
26
+ end
17
27
  read, write = IO.pipe
18
28
  tmp_pid = fork do
19
29
  read.close
@@ -22,6 +32,7 @@ module RakeServer
22
32
  run(eager_tasks, options) do
23
33
  write.write(Process.pid.to_s)
24
34
  write.close
35
+ STDIN.reopen('/dev/null')
25
36
  STDOUT.reopen('/dev/null')
26
37
  STDERR.reopen(STDOUT)
27
38
  end
@@ -40,6 +51,14 @@ module RakeServer
40
51
  pid = IO.read(pid_file).to_i
41
52
  begin
42
53
  Process.kill("TERM", pid)
54
+ begin
55
+ loop do
56
+ Process.kill(0, pid)
57
+ sleep(0.1)
58
+ end
59
+ rescue Errno::ESRCH
60
+ # Process is dead
61
+ end
43
62
  rescue Errno::ESRCH
44
63
  STDERR.puts("No rake-server process running at PID #{pid}")
45
64
  # No worries
data/rake_server.gemspec CHANGED
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{rake_server}
8
- s.version = "0.0.6"
8
+ s.version = "0.0.7"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Mat Brown", "Cedric Howe"]
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 6
9
- version: 0.0.6
8
+ - 7
9
+ version: 0.0.7
10
10
  platform: ruby
11
11
  authors:
12
12
  - Mat Brown