lib/snapshot/runner.rb in snapshot-0.9.2 vs lib/snapshot/runner.rb in snapshot-0.9.3

- old
+ new

@@ -83,11 +83,11 @@ SnapshotConfig.shared_instance.blocks[:teardown_language].call(language, device) # Callback SnapshotConfig.shared_instance.blocks[:teardown_device].call(device, language) # deprecated end def udid_for_simulator(name) # fetches the UDID of the simulator type - all = `instruments -s`.split("\n") + all = Simulators.raw_simulators.split("\n") all.each do |current| return current.match(/\[(.*)\]/)[1] if current.include?name end raise "Could not find simulator '#{name}' to install the app on." end @@ -98,17 +98,18 @@ app_identifier = ENV["SNAPSHOT_APP_IDENTIFIER"] app_identifier ||= @app_identifier def com(cmd) puts cmd.magenta if $verbose - result = `#{cmd} 2>&1` # to now show errors - puts result if (result.to_s.length > 0 and $verbose) + Open3.popen3("#{cmd} 2>&1") do |stdin, stdout, stderr, wait_thr| + result = stdout.read + puts result if (result.to_s.length > 0 and $verbose) + end end udid = udid_for_simulator(device) - com("killall 'iOS Simulator'") sleep 3 com("xcrun simctl boot '#{udid}'") com("xcrun simctl uninstall booted '#{app_identifier}'") sleep 3 @@ -195,9 +196,14 @@ raise "Could not find app in '#{build_dir}'. Make sure you're following the README and set the build directory to the correct path.".red end def parse_test_line(line) if line =~ /.*Target failed to run.*/ + return :retry + elsif line.include?"segmentation fault" # a new bug introduced with Xcode 7 + return :retry + elsif line.include?"Timed out waiting" # a new bug introduced with Xcode 7 + `killall "iOS Simulator"` return :retry elsif line.include?"Screenshot captured" return :screenshot elsif line.include? "Instruments wants permission to analyze other processes" return :need_permission