Class: Disloku::SysCmd

Inherits:
Object
  • Object
show all
Defined in:
lib/disloku/SysCmd.rb

Instance Method Summary collapse

Constructor Details

#initialize(cmd, *args) ⇒ SysCmd

Returns a new instance of SysCmd.



6
7
8
9
10
11
# File 'lib/disloku/SysCmd.rb', line 6

def initialize(cmd, *args)
	@cmd = cmd
	if (!args.empty?)
		@cmd = @cmd.gsub(/\$(\d+)/) { |m| args[m[1].to_i() - 1] }
	end
end

Instance Method Details

#executeObject



13
14
15
16
# File 'lib/disloku/SysCmd.rb', line 13

def execute()
	Log.instance.debug("executing '#{@cmd}'")
	return SysCmdResult.new(%x(#{@cmd}), $?)
end