Top Level Namespace

Extended by:
ASRake::FileUtilsExt

Defined Under Namespace

Modules: ASRake, FileUtils Classes: FlexSDK, Version

Instance Method Summary collapse

Methods included from ASRake::FileUtilsExt

cp_u

Instance Method Details

#run(command, abort_on_failure = true) ⇒ Object



52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
# File 'lib/asrake/util.rb', line 52

def run(command, abort_on_failure = true)
  command.strip!

  puts "> #{command}" if !block_given?
  IO.popen("#{command} 2>&1") do |proc|
    while !proc.closed? && (line = proc.gets)
      if block_given?
        yield line
      else
        puts ">    #{line}"
      end
    end
  end

  if $?.exitstatus != 0
    msg = "Operation exited with status #{$?.exitstatus}"
    raise msg if abort_on_failure
    #puts msg

  end

  return $?
end