Module: Exec

Defined in:
lib/exec.rb,
lib/exec/version.rb

Defined Under Namespace

Classes: CommandNotFoundException, NonZeroExitCodeException

Constant Summary collapse

VERSION =
'0.0.2'

Class Method Summary collapse

Class Method Details

._systemObject



11
# File 'lib/exec.rb', line 11

alias :_system :system

.system(*args) ⇒ Object



12
13
14
15
16
17
18
19
# File 'lib/exec.rb', line 12

def system(*args)
  _system(*args)
  case _system(*args)
    when true ; true
    when nil  ; raise CommandNotFoundException
    else $?.exitstatus
  end
end

.system!(*args) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/exec.rb', line 24

def system!(*args)
  case _system(*args)
    when true ; true
    when nil  ; raise CommandNotFoundException
    else      ; raise NonZeroExitCodeException
  end
end

.system_v(*args) ⇒ Object



20
21
22
23
# File 'lib/exec.rb', line 20

def system_v(*args)
  $stderr.puts(*args)
  system(*args)
end

.system_v!(*args) ⇒ Object



31
32
33
34
# File 'lib/exec.rb', line 31

def system_v!(*args)
  $stderr.puts(*args)
  system!(*args)
end