8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
|
# File 'lib/tango/shell.rb', line 8
def shell(command, *args)
options = { :echo => true, :env_vars => {} }
options.merge!(args.pop) if args.last.is_a?(Hash)
log "% #{command} #{args.join(' ')}\n\n" if options[:echo]
pid, pipe = fork_and_exec(command, options[:env_vars], *args)
output = collect_output(pipe, options[:echo])
Process.waitpid(pid)
pipe.close
log "" if options[:echo]
OpenStruct.new(
:output => output,
:status => $?.exitstatus,
:succeeded? => $?.success?,
:failed? => !$?.success?
)
end
|