Skip to content

Commit

Permalink
Fix monitor bug
Browse files Browse the repository at this point in the history
  • Loading branch information
greeneca committed Feb 7, 2017
1 parent 620ccdd commit 301513a
Show file tree
Hide file tree
Showing 5 changed files with 22 additions and 16 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG
@@ -1,3 +1,7 @@
= 3.12.2 =

- Fix bug with monitor not exiting

= 3.12.1 =

- Fix project selection when using the project_dir config value
Expand Down
2 changes: 1 addition & 1 deletion Gemfile.lock
@@ -1,7 +1,7 @@
PATH
remote: .
specs:
roku_builder (3.12.1)
roku_builder (3.12.2)
faraday (~> 0.11)
faraday-digestauth (~> 0.2)
git (~> 1.3)
Expand Down
29 changes: 16 additions & 13 deletions lib/roku_builder/monitor.rb
Expand Up @@ -73,20 +73,20 @@ def run_prompt(thread:)
while running
begin
if @show_prompt
command = Readline.readline('BrightScript Debugger> ', true)
if command =~ /^\s*$/ or Readline::HISTORY.to_a[-2] == command
Readline::HISTORY.pop
end
case command
when "q"
thread.exit
running = false
else
@show_prompt = false
thread[:connection].puts(command)
end
prompt = 'BrightScript Debugger> '
else
sleep 0.01
prompt = ''
end
command = Readline.readline(prompt, true)
if command =~ /^\s*$/ or Readline::HISTORY.to_a[-2] == command
Readline::HISTORY.pop
end
case command
when "q"
thread.exit
running = false
else
thread[:connection].puts(command)
end
rescue SystemExit, Interrupt
thread[:connection].puts("\C-c")
Expand All @@ -103,9 +103,12 @@ def manage_text(all_text:, txt:)
while line = all_text.slice!(/^.*\n/) do
puts line if !line.strip.empty?
end

if all_text.downcase == "BrightScript Debugger> ".downcase
@show_prompt = true
all_text = ""
else
@show_prompt = false
end
all_text
end
Expand Down
2 changes: 1 addition & 1 deletion lib/roku_builder/version.rb
Expand Up @@ -2,5 +2,5 @@

module RokuBuilder
# Version of the RokuBuilder Gem
VERSION = "3.12.1"
VERSION = "3.12.2"
end
1 change: 0 additions & 1 deletion test/roku_builder/test_monitor.rb
Expand Up @@ -12,7 +12,6 @@ def test_monitor_monit
logger: Logger.new("/dev/null")
}
monitor = RokuBuilder::Monitor.new(**device_config)
monitor.instance_variable_set(:@show_prompt, true)

connection.expect(:waitfor, nil) do |config|
assert_equal(/./, config['Match'])
Expand Down

0 comments on commit 301513a

Please sign in to comment.