module STDOUT
Public Class Methods
sh(*args)
click to toggle source
Report the command. Execute the command. Stdout and stderr are not redirected. Report the exit status at the end if nonzero. Returns a Process::Status object.
@param command a shell command to execute and report
# File lib/branch_io_cli/core_ext/io.rb, line 43 def STDOUT.sh(*args) args.last.delete(:obfuscate) if args.last.kind_of?(Hash) # TODO: Improve this implementation? say "<%= color(%q{$ #{IO.command_from_args(*args)}}, [MAGENTA, BOLD]) %>\n\n" # May also write to stderr # Cannot obfuscate here. system(*args) status = $? if status == 0 write "Success.\n\n" else write "#{status}\n\n" end status end