Class: ConvenientService::Examples::Rails::Gemfile::Services::RunShellCommand

Inherits:
Object
  • Object
show all
Includes:
RailsService::Config
Defined in:
lib/convenient_service/examples/rails/gemfile/services/run_shell_command.rb

Instance Method Summary collapse

Instance Method Details

#resultObject



23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/convenient_service/examples/rails/gemfile/services/run_shell_command.rb', line 23

def result
  ##
  # NOTE: When the command exit code is 0, `system` return `true`, and `false` otherwise.
  # - https://ruby-doc.org/core-3.1.2/Kernel.html#method-i-system
  # - https://stackoverflow.com/a/37329716/12201472
  #
  if system(command)
    success
  else
    error("#{command} returned non-zero exit code")
  end
end