Class | Tags::ExecuteCommandTag |
In: |
lib/webgen/plugins/tags/executecommand.rb
|
Parent: | DefaultTag |
Executes the given command and writes the standard output into the output file. All HTML special characters are escaped.
# File lib/webgen/plugins/tags/executecommand.rb, line 49 49: def process_tag( tag, chain ) 50: @process_output = param( 'processOutput' ) 51: command = param( 'command' ) 52: if command 53: cmd = ExtendedCommand.new( command ) 54: log(:debug) { "Executed command '#{command}', results: #{cmd.inspect}" } 55: output = cmd.out_text 56: if cmd.ret_code != 0 57: log(:error) { "Command '#{command}' did not return with exit value 0: #{cmd.err_text}" } 58: end 59: output = CGI::escapeHTML( output ) if param( 'escapeHTML' ) 60: if !param( 'highlight' ).nil? 61: output = @plugin_manager['Misc/SyntaxHighlighter'].highlight( output, param( 'highlight' ) ) 62: end 63: end 64: output 65: end