Skip to content

Commit

Permalink
document logger switch
Browse files Browse the repository at this point in the history
  • Loading branch information
jreidinger committed Nov 30, 2017
1 parent 9157546 commit c30afa1
Showing 1 changed file with 10 additions and 2 deletions.
12 changes: 10 additions & 2 deletions library/system/src/lib/yast2/execute.rb
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ module Yast
# (not prone to shell quoting bugs).
# It uses {http://www.rubydoc.info/github/openSUSE/cheetah/ Cheetah}
# as the backend, but adds support for chrooting during the installation.
# It also globally switches the default Cheetah logger to
# {http://www.rubydoc.info/github/yast/yast-ruby-bindings/Yast%2FLogger Y2Logger}.
class Execute
# use y2log by default
Cheetah.default_options = { logger: Y2Logger.instance }
Expand All @@ -40,6 +42,8 @@ class Execute
# in a `chroot(2)` specified by the installation (WFM.scr_root).
# Shows a {ReportClass#Error popup} if the command fails
# and returns `nil` in such case.
# It also globally switches the default Cheetah logger to
# {http://www.rubydoc.info/github/yast/yast-ruby-bindings/Yast%2FLogger Y2Logger}.
# @param args see http://www.rubydoc.info/github/openSUSE/cheetah/Cheetah.run
def self.on_target(*args)
popup_error { on_target!(*args) }
Expand All @@ -48,6 +52,8 @@ def self.on_target(*args)
# Runs with chroot; a failure becomes an exception.
# Runs a command described by *args*,
# in a `chroot(2)` specified by the installation (WFM.scr_root).
# It also globally switches the default Cheetah logger to
# {http://www.rubydoc.info/github/yast/yast-ruby-bindings/Yast%2FLogger Y2Logger}.
# @param args see http://www.rubydoc.info/github/openSUSE/cheetah/Cheetah.run
# @raise Cheetah::ExecutionFailed if the command fails
def self.on_target!(*args)
Expand All @@ -67,6 +73,8 @@ def self.on_target!(*args)
# *disregarding* a `chroot(2)` specified by the installation (WFM.scr_root).
# Shows a {ReportClass#Error popup} if the command fails
# and returns `nil` in such case.
# It also globally switches the default Cheetah logger to
# {http://www.rubydoc.info/github/yast/yast-ruby-bindings/Yast%2FLogger Y2Logger}.
# @param args see http://www.rubydoc.info/github/openSUSE/cheetah/Cheetah.run
def self.locally(*args)
popup_error { locally!(*args) }
Expand All @@ -75,8 +83,8 @@ def self.locally(*args)
# Runs without chroot; a failure becomes an exception.
# Runs a command described by *args*,
# *disregarding* a `chroot(2)` specified by the installation (WFM.scr_root).
# In other words, this is just an alias for `Cheetah.run`, provided for
# API orthogonality.
# It also globally switches the default Cheetah logger to
# {http://www.rubydoc.info/github/yast/yast-ruby-bindings/Yast%2FLogger Y2Logger}.
# @param args see http://www.rubydoc.info/github/openSUSE/cheetah/Cheetah.run
# @raise Cheetah::ExecutionFailed if the command fails
def self.locally!(*args)
Expand Down

0 comments on commit c30afa1

Please sign in to comment.