Sha256: b1fdf06b339733f31e519bcc3d5cb461a8bfbedfba097fa632a08ef72ad72c61
Contents?: true
Size: 986 Bytes
Versions: 6
Compression:
Stored size: 986 Bytes
Contents
require 'English' module Psychic module Shell class ExecutionError < StandardError attr_accessor :execution_result end class ExecutionResult attr_reader :exitstatus attr_reader :stdout attr_reader :stderr # coerce_value String, ->(v) { v.force_encoding('utf-8') } include Psychic::Util::Hashable def initialize(results) @exitstatus = results.fetch(:exitstatus) # Needs to be UTF-8 to serialize as YAML @stdout = results.fetch(:stdout).force_encoding('utf-8') @stderr = results.fetch(:stderr).force_encoding('utf-8') end def error! if @exitstatus != 0 error = ExecutionError.new error.execution_result = self fail error end end def to_s ''" Execution Result: exitstatus: #{exitstatus} stdout: #{stdout} stderr: #{stderr} "'' end end end end
Version data entries
6 entries across 6 versions & 1 rubygems