lib/fulmar/shell.rb in fulmar-shell-1.6.1 vs lib/fulmar/shell.rb in fulmar-shell-1.6.2
- old
+ new
@@ -3,11 +3,11 @@
# This shell is part of the fulmar deployment tools
# it can be used stand-alone, though
module Fulmar
# Implements simple access to shell commands
class Shell
- VERSION = '1.6.1'
+ VERSION = '1.6.2'
attr_accessor :debug, :last_output, :last_error, :quiet, :strict
attr_reader :path
DEFAULT_OPTIONS = {
@@ -26,10 +26,11 @@
@strict = false
@clean_environment = [] # list of things to clean from environment variables
end
def run(command, options = DEFAULT_OPTIONS)
+ reset_output
command = [command] if command.class == String
# is a custom path given?
if options[:in]
# is it absolute?
@@ -62,9 +63,14 @@
def path=(path)
@path = local? ? File.expand_path(path) : path
end
protected
+
+ def reset_output
+ @last_output = []
+ @last_error = []
+ end
def shell_command(login)
login ? "env -i HOME=\"#{ENV['HOME']}\" LANG=\"#{ENV['LANG']}\" bash -lc" : 'bash -c'
end