Parent

Methods

Included Modules

Class/Module Index [+]

Quicksearch

Webgen::Tag::ExecuteCommand

Executes the given command and returns the standard output. All special HTML characters are escaped.

Constants

BIT_BUCKET

Public Instance Methods

call(tag, body, context) click to toggle source

Execute the command and return the standard output.

# File lib/webgen/tag/executecommand.rb, line 17
def call(tag, body, context)
  command = param('tag.executecommand.command')
  output = `#{command} 2> #{BIT_BUCKET}`
  if $?.exitstatus != 0
    raise Webgen::RenderError.new("Command '#{command}' has return value != 0: #{output}",
                                  self.class.name, context.dest_node, context.ref_node)
  end
  output = CGI::escapeHTML(output) if param('tag.executecommand.escape_html')
  [output, param('tag.executecommand.process_output')]
end

[Validate]

Generated with the Darkfish Rdoc Generator 2.