Method: PDFToImage.exec

Defined in:
lib/pdftoimage.rb

.exec(cmd, error = nil) ⇒ String

Executes the specified command, returning the output.

Parameters:

  • The (cmd)

    command to run

Returns:

  • (String)

    The output of the command



60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/pdftoimage.rb', line 60

def exec(cmd, error = nil)
  output = `#{cmd}`
  if $? != 0
    if error == nil
      raise PDFError, "Error executing command: #{cmd}"
    else
      raise PDFError, error
    end
  end

  return output
end