@@ -179,7 +179,6 @@ def self.run(*args, global: false, file: nil, subcommand: "", services: false)
179
179
params (
180
180
entries : T ::Array [ Homebrew ::Bundle ::Dsl ::Entry ] ,
181
181
_block : T . proc . params (
182
- entry : Homebrew ::Bundle ::Dsl ::Entry ,
183
182
info : T ::Hash [ String , T . anything ] ,
184
183
service_file : Pathname ,
185
184
conflicting_services : T ::Array [ T ::Hash [ String , T . anything ] ] ,
@@ -246,20 +245,15 @@ def self.run(*args, global: false, file: nil, subcommand: "", services: false)
246
245
247
246
raise "Failed to get service info for #{ entry . name } " if info . nil?
248
247
249
- yield entry , info , service_file , conflicting_services
248
+ yield info , service_file , conflicting_services
250
249
end
251
250
end
252
251
253
252
sig { params ( entries : T ::Array [ Homebrew ::Bundle ::Dsl ::Entry ] , _block : T . nilable ( T . proc . void ) ) . void }
254
253
private_class_method def self . run_services ( entries , &_block )
255
- entries_to_stop = [ ]
256
254
services_to_restart = [ ]
257
255
258
- map_service_info ( entries ) do |entry , info , service_file , conflicting_services |
259
- # Don't restart if already running this version
260
- loaded_file = Pathname . new ( info [ "loaded_file" ] . to_s )
261
- next if info [ "running" ] && loaded_file &.file? && loaded_file &.realpath == service_file . realpath
262
-
256
+ map_service_info ( entries ) do |info , service_file , conflicting_services |
263
257
if info [ "running" ] && !Bundle ::BrewServices . stop ( info [ "name" ] , keep : true )
264
258
opoo "Failed to stop #{ info [ "name" ] } service"
265
259
end
@@ -275,8 +269,6 @@ def self.run(*args, global: false, file: nil, subcommand: "", services: false)
275
269
unless Bundle ::BrewServices . run ( info [ "name" ] , file : service_file )
276
270
opoo "Failed to start #{ info [ "name" ] } service"
277
271
end
278
-
279
- entries_to_stop << entry
280
272
end
281
273
282
274
return unless block_given?
@@ -285,7 +277,7 @@ def self.run(*args, global: false, file: nil, subcommand: "", services: false)
285
277
yield
286
278
ensure
287
279
# Do a full re-evaluation of services instead state has changed
288
- stop_services ( entries_to_stop )
280
+ stop_services ( entries )
289
281
290
282
services_to_restart . each do |service |
291
283
next if Bundle ::BrewServices . run ( service )
@@ -297,7 +289,7 @@ def self.run(*args, global: false, file: nil, subcommand: "", services: false)
297
289
298
290
sig { params ( entries : T ::Array [ Homebrew ::Bundle ::Dsl ::Entry ] ) . void }
299
291
private_class_method def self . stop_services ( entries )
300
- map_service_info ( entries ) do |_ , info , _ , _ |
292
+ map_service_info ( entries ) do |info , _ , _ |
301
293
next unless info [ "loaded" ]
302
294
303
295
# Try avoid services not started by `brew bundle services`
0 commit comments