Skip to content

Commit 0585a2f

Browse files
committed
Wait for emulators to exit before deleting thems.
1 parent 3c1714d commit 0585a2f

1 file changed

Lines changed: 7 additions & 1 deletion

File tree

lib/fastlane/plugin/automated_test_emulator_run/actions/automated_test_emulator_run_action.rb

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,9 @@ def self.run(params)
9393

9494
# Launching AVDs
9595
UI.message("Launching all AVDs at the same time.".yellow)
96+
pids = []
9697
for i in 0...avd_controllers.length
97-
Process.fork do
98+
pids << Process.fork do
9899
Action.sh(avd_controllers[i].command_start_avd)
99100
end
100101
end
@@ -219,6 +220,11 @@ def self.run(params)
219220

220221
# Delete AVDs
221222
if params[:AVD_clean_after]
223+
UI.message(["Waiting for ", avd_schemes[i].avd_name, " to finish..."].join("").yellow)
224+
begin_waiting = Time.now
225+
Process.wait(pids[i])
226+
waited = (Time.now - begin_waiting).to_i
227+
UI.message(["Finished in ", waited, " seconds"].join("").yellow)
222228
UI.message("AVD_clean_after param set to true. Deleting AVDs.".green)
223229
Action.sh(avd_controllers[i].command_delete_avd)
224230
else

0 commit comments

Comments
 (0)