Sha256: 6dfee0a0d5915537508d1ff4e13cd7a2391f10a0c581dd42ceafb13f2eba3f0e
Contents?: true
Size: 819 Bytes
Versions: 3
Compression:
Stored size: 819 Bytes
Contents
# frozen_string_literal: true module TTY class Command # An ExitError reports an unsuccessful exit by command. # # The error message includes: # * the name of command executed # * the exit status # * stdout bytes # * stderr bytes # # @api private class ExitError < RuntimeError def initialize(cmd_name, result) super(info(cmd_name, result)) end def info(cmd_name, result) "Running `#{cmd_name}` failed with\n" \ " exit status: #{result.exit_status}\n" \ " stdout: #{extract_output(result.out)}\n" \ " stderr: #{extract_output(result.err)}\n" end def extract_output(value) (value || '').strip.empty? ? 'Nothing written' : value.strip end end # ExitError end # Command end # TTY
Version data entries
3 entries across 3 versions & 2 rubygems
Version | Path |
---|---|
outstand-tty-command-0.10.0 | lib/tty/command/exit_error.rb |
outstand-tty-command-0.10.0.pre | lib/tty/command/exit_error.rb |
tty-command-0.9.0 | lib/tty/command/exit_error.rb |