class Opal::CLI
def evals_or_file_source
Internal: Yields a string of source code and the proper filename for either
def evals_or_file_source return if lib_only # --library return @cached_content if @cached_content unless file.tty? begin file.rewind can_read_again = true rescue Errno::ESPIPE # rubocop:disable Lint/HandleExceptions # noop end end if @cached_content.nil? || can_read_again # On MacOS file.read is not enough to pick up changes, probably due to some # cache or buffer, unclear if coming from ruby or the OS. content = File.file?(file) ? File.read(file) : file.read end @cached_content ||= content unless can_read_again content end