Sha256: 6bdeb6351a1132248d7808ee343ebe45ceea100286b685cad7cd1a6a700f40c1
Contents?: true
Size: 704 Bytes
Versions: 4
Compression:
Stored size: 704 Bytes
Contents
# Implementation of sh from github-gem # https://github.com/defunkt/github-gem require 'open3' module Tonic class Shell < String attr_reader :error attr_reader :out def self.run(*command) self.new(*command).run end def initialize(*command) @command = command end def run out = err = nil Open3.popen3(*@command) do |_, pout, perr| out = pout.read.strip err = perr.read.strip end replace @error = err unless err.empty? replace @out = out unless out.empty? self end def command @command.join(' ') end def error? !!@error end def out? !!@out end end end
Version data entries
4 entries across 4 versions & 1 rubygems
Version | Path |
---|---|
tonic-0.0.6 | lib/tonic/shell.rb |
tonic-0.0.4 | lib/tonic/shell.rb |
tonic-0.0.3 | lib/tonic/shell.rb |
tonic-0.0.2 | lib/tonic/shell.rb |