lib/run_loop/device.rb in run_loop-1.5.5 vs lib/run_loop/device.rb in run_loop-1.5.6.pre1
- old
+ new
@@ -269,13 +269,11 @@
# The size of the simulator data/ directory.
#
# TODO needs unit tests.
def simulator_data_dir_size
path = File.join(simulator_root_dir, 'data')
- args = ['du', '-m', '-d', '0', path]
- hash = xcrun.exec(args)
- hash[:out].split(' ').first.to_i
+ RunLoop::Directory.size(path, :mb)
end
# @!visibility private
#
# Waits for three conditions:
@@ -314,17 +312,15 @@
path = File.join(simulator_root_dir, 'data')
current_sha = nil
sha_fn = lambda do |data_dir|
begin
- # Directory.directory_digest has a blocking read. Typically, it
- # returns in < 0.3 seconds.
+ # Typically, this returns in < 0.3 seconds.
Timeout.timeout(2, TimeoutError) do
RunLoop::Directory.directory_digest(data_dir)
end
- rescue => e
- RunLoop.log_error(e) if RunLoop::Environment.debug?
+ rescue => _
SecureRandom.uuid
end
end
current_line = nil
@@ -385,10 +381,14 @@
RunLoop.log_error("Caught #{e} while reading simulator log file") if debug
ensure
io.close if io && !io.closed?
end
- line
+ if line
+ line.chomp
+ else
+ line
+ end
end
# @!visibility private
def xcrun
RunLoop::Xcrun.new