Sha256: caa7f45d29012e89a6c25b0f51fd7dccd116e71e61db090ce8e13f7c3edc62b7
Contents?: true
Size: 595 Bytes
Versions: 37
Compression:
Stored size: 595 Bytes
Contents
# frozen_string_literal: true require "open3" module Bridgetown 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
37 entries across 37 versions & 1 rubygems