Class: PipeLog

Inherits:
Fox::FXText
  • Object
show all
Includes:
Fox, Responder
Defined in:
lib/piggy-gui/pipe_log.rb

Overview

A widget to run external programms and view their output using FXRuby.

Constant Summary collapse

UsePipes =
true

Instance Method Summary collapse

Constructor Details

#initialize(parent) ⇒ PipeLog

Returns a new instance of PipeLog.



14
15
16
17
18
# File 'lib/piggy-gui/pipe_log.rb', line 14

def initialize(parent)
  super(parent)
  @input_types = INPUT_READ|INPUT_EXCEPT
  @pipes = Array.new
end

Instance Method Details

#close_pipesObject

This should be used explicitly before destruction



31
32
33
34
# File 'lib/piggy-gui/pipe_log.rb', line 31

def close_pipes
  @pipes.each { |p| getApp().removeInput(p, @input_types) }
  @pipes = Array.new
end

#has_open_pipes?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/piggy-gui/pipe_log.rb', line 26

def has_open_pipes?
  !@pipes.empty?
end

#run_command(commandline, working_dir, spawn = false) ⇒ Object



20
21
22
23
24
# File 'lib/piggy-gui/pipe_log.rb', line 20

def run_command(commandline, working_dir, spawn = false)
  in_path(working_dir) {
    run_command_and_display_output(commandline, spawn)
  }
end