Skip to content
This repository has been archived by the owner on Oct 24, 2019. It is now read-only.

Commit

Permalink
System: Use Logging.logger, not Vigil.logger
Browse files Browse the repository at this point in the history
  • Loading branch information
kjellm committed May 7, 2013
1 parent 8988b7b commit 8c0db5c
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions lib/vigil/system.rb
Expand Up @@ -3,6 +3,10 @@

class Vigil
class System

def initialize()
@log = Logging.logger[self]
end

def run_command(command)
output = []
Expand Down Expand Up @@ -31,19 +35,19 @@ def run_command(command)
end

def system(*cmd)
Vigil.logger.info "$ #{cmd}"
@log.info "$ #{cmd}"
stat = super *cmd
Vigil.logger.info "Exitstatus: #{stat} #{$?.inspect}"
@log.info "Exitstatus: #{stat} #{$?.inspect}"
unless stat
block_given? ? yield($?) : raise("Failed")
end
stat
end

def backticks(cmd)
Vigil.logger.info "$ #{cmd}"
@log.info "$ #{cmd}"
output = `#{cmd}`
Vigil.logger.info "Exitstatus: #{$?.inspect}"
@log.info "Exitstatus: #{$?.inspect}"
raise "Failed: #{$?.exitstatus}" if $?.exitstatus != 0
output
end
Expand Down

0 comments on commit 8c0db5c

Please sign in to comment.