module Rails::Generators::Actions

def execute_command(executor, command, options = {}) # :doc:

:doc:
based on the executor parameter provided.
Runs the supplied command using either "rake ..." or "rails ..."
def execute_command(executor, command, options = {}) # :doc:
  log executor, command
  sudo = options[:sudo] && !Gem.win_platform? ? "sudo " : ""
  config = {
    env: { "RAILS_ENV" => (options[:env] || ENV["RAILS_ENV"] || "development") },
    verbose: false,
    capture: options[:capture],
    abort_on_failure: options[:abort_on_failure],
  }
  in_root { run("#{sudo}#{Shellwords.escape Gem.ruby} bin/#{executor} #{command}", config) }
end