module Nexocop::Bash

Public Class Methods

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