Class: CopyBot::ShellCommand

Inherits:
Object
  • Object
show all
Defined in:
lib/copy_bot/shell_command.rb

Instance Method Summary collapse

Constructor Details

#initialize(command) ⇒ ShellCommand

Returns a new instance of ShellCommand.

Parameters:

  • command (String)


4
5
6
# File 'lib/copy_bot/shell_command.rb', line 4

def initialize(command)
  @command = command
end

Instance Method Details

#executeFalseClass, TrueClass

Returns:

  • (FalseClass, TrueClass)


9
10
11
12
13
14
15
# File 'lib/copy_bot/shell_command.rb', line 9

def execute
  stdout, stderr, status = Open3.capture3(command)
  return true if status.exitstatus&.zero?

  CopyBot.config.logger.debug { "#{stdout}, #{stderr}" }
  false
end