Class: Guard::Internals::Debugging

Inherits:
Object
  • Object
show all
Defined in:
lib/guard/internals/debugging.rb

Constant Summary collapse

TRACES =
[
  [Kernel, :system],
  [Kernel, :spawn],
  [Kernel, :`],
  [Open3, :popen3]
]

Class Method Summary collapse

Class Method Details

.startObject

Sets up debugging:

  • aborts on thread exceptions

  • Set the logging level to `:debug`

  • traces execution of Kernel.system and backtick calls


26
27
28
29
30
31
32
33
34
35
36
# File 'lib/guard/internals/debugging.rb', line 26

def start
  return if @started ||= false
  @started = true

  Thread.abort_on_exception = true

  UI.level = Logger::DEBUG

  TRACES.each { |mod, meth| _trace(mod, meth, &method(:_notify)) }
  @traced = true
end

.stopObject


38
39
40
41
42
# File 'lib/guard/internals/debugging.rb', line 38

def stop
  return unless @started ||= false
  UI.level = Logger::INFO
  _reset
end