Skip to content

Commit

Permalink
add a timeout
Browse files Browse the repository at this point in the history
  • Loading branch information
JoeSSS committed Aug 3, 2021
1 parent b1f61e3 commit 62312b6
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 5 deletions.
2 changes: 1 addition & 1 deletion Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
fastlane-plugin-mango (1.3.34)
fastlane-plugin-mango (1.3.35)
docker-api

GEM
Expand Down
11 changes: 8 additions & 3 deletions lib/fastlane/plugin/mango/helper/emulator_language.rb
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
require 'timeout'

module Fastlane
module Helper
module EmulatorLanguage
Expand All @@ -9,9 +11,12 @@ def self.set(lang, docker_commander)
country = lang.split('_')[1]
apk_path = File.join(File.dirname(__FILE__), 'settings.apk')
docker_commander.cp(file: apk_path)
docker_commander.exec(command: 'adb install /root/tests/settings.apk')
docker_commander.exec(command: 'adb shell pm grant io.appium.settings android.permission.CHANGE_CONFIGURATION')
docker_commander.exec(command: "adb shell am broadcast -a io.appium.settings.locale -n io.appium.settings/.receivers.LocaleSettingReceiver --es lang #{language} --es country #{country}")

Timeout.timeout(20) do
docker_commander.exec(command: 'adb install /root/tests/settings.apk')
docker_commander.exec(command: 'adb shell pm grant io.appium.settings android.permission.CHANGE_CONFIGURATION')
docker_commander.exec(command: "adb shell am broadcast -a io.appium.settings.locale -n io.appium.settings/.receivers.LocaleSettingReceiver --es lang #{language} --es country #{country}")
end
rescue StandardError => e
raise e if retries.zero?

Expand Down
2 changes: 1 addition & 1 deletion lib/fastlane/plugin/mango/version.rb
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
module Fastlane
module Mango
VERSION = '1.3.34'.freeze
VERSION = '1.3.35'.freeze
end
end

0 comments on commit 62312b6

Please sign in to comment.