lib/termup/base.rb in termup-3.0.0 vs lib/termup/base.rb in termup-3.0.1
- old
+ new
@@ -7,16 +7,23 @@
@process = process
@lines = []
end
def start
- script = <<-JS
+ script = <<-JS.gsub(/^\s+/, '')
var app = Application(#{@process.pid});
var se = Application('System Events');
app.activate();
- #{@lines.join(';')}
+ #{@lines.join(";\n")}
JS
ExecJS.exec script
+
+ rescue ExecJS::RuntimeError => e
+ script.split("\n").each.with_index do |line, i|
+ index = (i+1).to_s.rjust(3)
+ puts "#{index}: #{line}"
+ end
+ puts e.message
end
protected
def hit(key, *using)