module Dory::Bash

Public Class Methods

escape_double_quotes(str) click to toggle source
# File lib/dory/shell.rb, line 16
def self.escape_double_quotes(str)
  str.gsub('"', '\\"')
end
run_command(command) click to toggle source
# File lib/dory/shell.rb, line 20
def self.run_command(command)
  stdout = `bash -c "#{self.escape_double_quotes(command)}"`
  OpenStruct.new({
    success?: $?.exitstatus == 0,
    exitstatus: $?.exitstatus,
    stdout: stdout
  })
end