module Grapht::Shell

Constants

ALLOWED_OPTIONS
CMD

Public Class Methods

exec(type, json_data, options={}) click to toggle source
# File lib/grapht/shell.rb, line 10
def self.exec(type, json_data, options={})
  options = *options.select { |k,v| ALLOWED_OPTIONS.include? k }.flatten

  out, err, status =
    Open3.capture3 CMD, type, *options, stdin_data: json_data

  raise Grapht::Shell::Error, err unless status.success?
  out
end