public
Fork of mojombo/god
Description: Ruby process monitor
Homepage: http://god.rubyforge.org
Clone URL: git://github.com/Bertg/god.git
all tests passing and no extraneous output!
mojombo (author)
Mon Jan 28 15:39:36 -0800 2008
commit  68a07c1f9b7ee371bd12a20ddfbe874a67d13918
tree    998e87d2630c09afd3c75caf79a297255682a98e
parent  f0c22dc03cabd961a8969905a9e485966a6cacdb
...
181
182
183
184
185
186
187
188
...
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
...
227
228
229
230
231
232
233
234
...
181
182
183
 
 
184
185
186
...
197
198
199
 
 
200
201
202
 
 
203
204
205
206
207
 
 
208
209
210
...
219
220
221
 
 
222
223
224
0
@@ -181,8 +181,6 @@ module God
0
           ::Process.kill('KILL', pid) rescue nil
0
         end
0
       end
0
-
0
- print "a - #{System::Process.new(::Process.pid).memory}\n"; sleep 1
0
             
0
       if command.kind_of?(String)
0
         pid = nil
0
@@ -199,20 +197,14 @@ module God
0
               puts pid.to_s # send pid back to forker
0
             end
0
             
0
- print "b - #{System::Process.new(::Process.pid).memory}\n"; sleep 1
0
-
0
             ::Process.waitpid(opid, 0)
0
             w.close
0
             pid = r.gets.chomp
0
-
0
- print "c - #{System::Process.new(::Process.pid).memory}\n"; sleep 1
0
           ensure
0
             # make sure the file descriptors get closed no matter what
0
             r.close rescue nil
0
             w.close rescue nil
0
           end
0
-
0
- print "d - #{System::Process.new(::Process.pid).memory}\n"; sleep 1
0
         else
0
           # single fork self-daemonizing processes
0
           # we want to wait for them to finish
0
@@ -227,8 +219,6 @@ module God
0
           ensure_stop if action == :stop
0
         end
0
         
0
- print "e - #{System::Process.new(::Process.pid).memory}\n"
0
-
0
         if @tracking_pid or (@pid_file.nil? and WRITES_PID.include?(action))
0
           File.open(default_pid_file, 'w') do |f|
0
             f.write pid
...
11
12
13
 
 
 
 
 
14
15
16
...
11
12
13
14
15
16
17
18
19
20
21
0
@@ -11,6 +11,11 @@ class TestGod < Test::Unit::TestCase
0
   
0
   def teardown
0
     God.main && God.main.kill
0
+ if God.watches
0
+ God.watches.each do |k, w|
0
+ w.driver.thread.kill
0
+ end
0
+ end
0
   end
0
   
0
   # applog
...
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
...
69
70
71
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
72
73
0
@@ -69,20 +69,4 @@ class TestMetric < Test::Unit::TestCase
0
       @metric.condition(:invalid) { }
0
     end
0
   end
0
-
0
- # enable
0
-
0
- def test_enable_should_attach_conditions
0
- @metric.condition(:fake_poll_condition)
0
- Hub.expects(:attach).with(@metric.conditions.first, @metric)
0
- @metric.enable
0
- end
0
-
0
- # disable
0
-
0
- def test_disable_should_detach_conditions
0
- @metric.condition(:fake_poll_condition)
0
- Hub.expects(:detach).with(@metric.conditions.first)
0
- @metric.disable
0
- end
0
 end
0
\ No newline at end of file
...
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
...
2
3
4
 
5
 
 
 
 
 
 
 
 
 
 
 
6
7
8
0
@@ -2,19 +2,7 @@ require File.dirname(__FILE__) + '/helper'
0
 
0
 class TestTask < Test::Unit::TestCase
0
   def setup
0
- God::Socket.stubs(:new).returns(true)
0
     God.internal_init
0
- God.reset
0
-
0
- God.watch do |w|
0
- w.name = 'foo'
0
- w.start = 'bar'
0
- w.interval = 10
0
- end
0
-
0
- @watch = God.watches['foo']
0
-
0
-
0
     @task = Task.new
0
     @task.name = 'foo'
0
     @task.valid_states = [:foo, :bar]

Comments

    No one has commented yet.