Sha256: 2fb31c18942fc4f1d31c981c448b1766af4d8eb57768a9b76715e76ae16c2528
Contents?: true
Size: 977 Bytes
Versions: 4
Compression:
Stored size: 977 Bytes
Contents
# frozen_string_literal: true module Nonnative class GoCommand def initialize(main, output) @main = main @output = output end def executable(cmd, *params) params = params.join(' ') "#{main} #{flags(cmd, params).join(' ')} #{cmd} #{params}" end def execute(cmd, *params) Open3.popen3(executable(cmd, params)) do |_stdin, stdout, stderr, wait_thr| return stdout.read, stderr.read, wait_thr.value end end private attr_reader :main, :output def flags(cmd, params) m = File.basename(main, File.extname(main)) p = params.gsub(/\W/, '') path = "#{output}/#{m}-#{cmd}-#{p}" [ "-test.cpuprofile=#{path}-cpu.prof", "-test.memprofile=#{path}-mem.prof", "-test.blockprofile=#{path}-block.prof", "-test.mutexprofile=#{path}-mutex.prof", "-test.coverprofile=#{path}.cov", "-test.trace=#{path}-trace.out" ] end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
nonnative-1.34.0 | lib/nonnative/go_command.rb |
nonnative-1.31.0 | lib/nonnative/go_command.rb |
nonnative-1.30.0 | lib/nonnative/go_command.rb |
nonnative-1.29.0 | lib/nonnative/go_command.rb |