Sha256: 1d5405ada0867a07028022a3edb62b480b81c74bc123dc0ddcbba807d5776166
Contents?: true
Size: 557 Bytes
Versions: 62
Compression:
Stored size: 557 Bytes
Contents
require "open3" module J1 module Utils module Exec extend self # Runs a program in a sub-shell. # # *args - a list of strings containing the program name and arguments # # Returns a Process::Status and a String of output in an array in # that order. def run(*args) stdin, stdout, stderr, process = Open3.popen3(*args) out = stdout.read.strip err = stderr.read.strip [stdin, stdout, stderr].each(&:close) [process.value, out + err] end end end end
Version data entries
62 entries across 62 versions & 3 rubygems