Module: Postgres::Clone::LocalCommands

Includes:
CommandLine
Included in:
Commands
Defined in:
lib/postgres/clone/local_commands.rb

Constant Summary

Constants included from Logger

Postgres::Clone::Logger::DEFAULT_COLOR

Instance Method Summary collapse

Methods included from CommandLine

#build_command, #log_command

Methods included from Logger

#log_message

Instance Method Details

#run_local(command, sudo: false, user: nil) ⇒ Object



9
10
11
12
13
14
15
16
# File 'lib/postgres/clone/local_commands.rb', line 9

def run_local(command, sudo: false, user: nil)
  actual_command = build_command(command, sudo: sudo, user: user)
  log_command('localhost', actual_command)

  output = `#{actual_command}`

  CommandResult.new(exit_code: $?.exitstatus, output: output)
end

#sudo_local(command, user: nil) ⇒ Object



18
19
20
# File 'lib/postgres/clone/local_commands.rb', line 18

def sudo_local(command, user: nil)
  run_local(command, sudo: true, user: user)
end