Sha256: 72e9f6f17f8172fe8078b7d279c1e02fd175fa377fe79a8dc334b4eabee32677
Contents?: true
Size: 827 Bytes
Versions: 33
Compression:
Stored size: 827 Bytes
Contents
# frozen_string_literal: true require 'parallel_tests' module ParallelTests module Gherkin module Io def prepare_io(path_or_io) if path_or_io.respond_to?(:write) path_or_io else # its a path File.open(path_or_io, 'w').close # clean out the file file = File.open(path_or_io, 'a') at_exit do unless file.closed? file.flush file.close end end file end end # do not let multiple processes get in each others way def lock_output if @io.is_a?(File) begin @io.flock File::LOCK_EX yield ensure @io.flock File::LOCK_UN end else yield end end end end end
Version data entries
33 entries across 33 versions & 1 rubygems