# Author:: Nicolas Pouillard . # Copyright:: Copyright (c) 2004, 2005 TTK team. All rights reserved. # License:: LGPL # $Id: SubCmd.rb 578 2005-04-14 20:46:09Z ertai $ module TTK module Strategies class SubCmd < CmdBase include Concrete def prologue @command = ABS_ME super end protected :prologue def run_impl super raise_error "bad exit status #@my_exit" unless @my_exit.zero? raise_error 'no ttk output' unless @output.my.exist? stream = YAML::load_stream(@output.my.read) raise_error 'bad ttk output' if stream.nil? doc, @status = stream[0], stream[1] raise_error 'bad doc output' unless doc.is_a? Filters::Saver raise_error 'bad status output' unless @status.is_a? Status doc.repeat(@log) # raise_error 'ttk stderr not empty' unless @error.my.zero? raise_status @status end protected :run_impl def error_hook @log.my_stdout = @output.my.read if @output and @output.my.exist? @log.my_stderr = @error.my.read if @error and @error.my.exist? super end protected :error_hook def mk_command @args = "#@args -P Notif --dump-status" super end protected :mk_command end # class SubCmd end # module Strategies end # module TTK