Sha256: b466e7f4c918e0b1a8a7c836c8a31739c5d4e36b6ff741ad8a233c0bdd88419c
Contents?: true
Size: 595 Bytes
Versions: 10
Compression:
Stored size: 595 Bytes
Contents
module Kagu module SwiftHelper def self.execute(code, &block) tempfile = Tempfile.new begin tempfile << code ensure tempfile.close end begin stdout, stderr, result = Open3.capture3("swift #{tempfile.path.inspect}") raise(stderr.presence || "Swift command returned with code: #{result.exitstatus}") unless result.success? if block_given? stdout.lines.each { |line| yield(line.chomp) } nil else stdout end ensure tempfile.unlink end end end end
Version data entries
10 entries across 10 versions & 1 rubygems