scriptty 0.7.0-java → 0.8.0-java
Sign up to get free protection for your applications and to get access to all the features.
- data/README.rdoc +17 -0
- data/VERSION +1 -1
- data/lib/scriptty/expect.rb +26 -1
- data/lib/scriptty/net/event_loop.rb +30 -0
- metadata +3 -3
data/README.rdoc
CHANGED
@@ -13,6 +13,23 @@ Limited DG410 and XTerm support.
|
|
13
13
|
- Treetop
|
14
14
|
- Multibyte
|
15
15
|
|
16
|
+
= Known issues
|
17
|
+
|
18
|
+
== Glassfish SocketChannel.keyFor bug
|
19
|
+
|
20
|
+
There is a known bug in the JDK that causes SocketChannel.keyFor to behave
|
21
|
+
erroneously under some versions of Glassfish. (Glassfish versions 2.1.1 and
|
22
|
+
3.0 or later are not affected.) A possible workaround for v2.0 is to add the
|
23
|
+
following to the appropriate section of your Glassfish config/domain.xml file:
|
24
|
+
|
25
|
+
<jvm-options>-Dcom.sun.enterprise.server.ss.ASQuickStartup=false</jvm-options>
|
26
|
+
|
27
|
+
See the following pages for more information:
|
28
|
+
|
29
|
+
- https://glassfish.dev.java.net/issues/show_bug.cgi?id=3027
|
30
|
+
- http://docs.sun.com/app/docs/doc/820-4276/knownissuessges?a=view
|
31
|
+
- http://bugs.sun.com/view_bug.do?bug_id=6562829
|
32
|
+
|
16
33
|
= License
|
17
34
|
|
18
35
|
Copyright © 2010 Infonium Inc.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.8.0
|
data/lib/scriptty/expect.rb
CHANGED
@@ -22,12 +22,13 @@ require 'scriptty/term'
|
|
22
22
|
require 'scriptty/screen_pattern'
|
23
23
|
require 'scriptty/util/transcript/writer'
|
24
24
|
require 'set'
|
25
|
+
require 'pp'
|
25
26
|
|
26
27
|
module ScripTTY
|
27
28
|
class Expect
|
28
29
|
|
29
30
|
# Methods to export to Evaluator
|
30
|
-
EXPORTED_METHODS = Set.new [:init_term, :term, :connect, :screen, :expect, :on, :wait, :send, :send_password, :capture, :match, :push_patterns, :pop_patterns, :exit, :eval_script_file, :eval_script_inline, :sleep, :set_timeout, :load_screens ]
|
31
|
+
EXPORTED_METHODS = Set.new [:init_term, :term, :connect, :screen, :expect, :on, :wait, :send, :send_password, :capture, :match, :push_patterns, :pop_patterns, :exit, :eval_script_file, :eval_script_inline, :sleep, :set_timeout, :load_screens, :print, :puts, :p, :pp ]
|
31
32
|
|
32
33
|
attr_reader :term # The terminal emulation object
|
33
34
|
|
@@ -279,6 +280,30 @@ module ScripTTY
|
|
279
280
|
end
|
280
281
|
end
|
281
282
|
|
283
|
+
# Like regular Ruby "puts", but also logs to the transcript.
|
284
|
+
def puts(*args)
|
285
|
+
@transcript_writer.info("puts", *args.map{|a| a.to_s}) if @transcript_writer
|
286
|
+
Kernel.puts(*args)
|
287
|
+
end
|
288
|
+
|
289
|
+
# Like regular Ruby "print", but also logs to the transcript.
|
290
|
+
def print(*args)
|
291
|
+
@transcript_writer.info("print", *args.map{|a| a.to_s}) if @transcript_writer
|
292
|
+
Kernel.print(*args)
|
293
|
+
end
|
294
|
+
|
295
|
+
# Like regular Ruby "p", but also logs to the transcript.
|
296
|
+
def p(*args)
|
297
|
+
@transcript_writer.info("p", *args.map{|a| a.to_s}) if @transcript_writer
|
298
|
+
Kernel.p(*args)
|
299
|
+
end
|
300
|
+
|
301
|
+
# Like regular Ruby "pp", but also logs to the transcript.
|
302
|
+
def pp(*args)
|
303
|
+
@transcript_writer.info("pp", *args.map{|a| a.to_s}) if @transcript_writer
|
304
|
+
PP.pp(*args)
|
305
|
+
end
|
306
|
+
|
282
307
|
private
|
283
308
|
|
284
309
|
# Kick the watchdog timer
|
@@ -95,6 +95,7 @@ module ScripTTY
|
|
95
95
|
# not specifiy any on_accept or on_close/on_read_bytes callbacks.
|
96
96
|
schan.register(@selector, SelectionKey::OP_ACCEPT)
|
97
97
|
selection_key = schan.keyFor(@selector) # SelectionKey object
|
98
|
+
check_glassfish_issue3027(selection_key)
|
98
99
|
selection_key.attach({:listening_socket_wrapper => lw})
|
99
100
|
if block
|
100
101
|
block.call(lw)
|
@@ -138,6 +139,7 @@ module ScripTTY
|
|
138
139
|
# on_connect or on_close/on_read_bytes callbacks.
|
139
140
|
chan.register(@selector, SelectionKey::OP_CONNECT)
|
140
141
|
selection_key = chan.keyFor(@selector) # SelectionKey object
|
142
|
+
check_glassfish_issue3027(selection_key)
|
141
143
|
selection_key.attach({:connection_wrapper => cw})
|
142
144
|
if block_given?
|
143
145
|
yield cw
|
@@ -281,6 +283,7 @@ module ScripTTY
|
|
281
283
|
end
|
282
284
|
if accepted
|
283
285
|
socket_channel.register(@selector, SelectionKey::OP_READ) # Register the channel with the selector
|
286
|
+
check_glassfish_issue3027(socket_channel.keyFor(@selector))
|
284
287
|
cw = ConnectionWrapper.new(self, socket_channel)
|
285
288
|
invoke_callback(k.channel, :on_accept, cw)
|
286
289
|
end
|
@@ -488,6 +491,33 @@ module ScripTTY
|
|
488
491
|
k.attachment
|
489
492
|
end
|
490
493
|
|
494
|
+
# Check for a known issue that sometimes occurs when running under
|
495
|
+
# Glassfish.
|
496
|
+
def check_glassfish_issue3027(selection_key)
|
497
|
+
return unless selection_key.nil?
|
498
|
+
message = <<EOF
|
499
|
+
ERROR: Erroneous Java/Glassfish SocketChannel.keyFor detected"
|
500
|
+
********************************************************************************
|
501
|
+
* There is a known bug in the JDK that causes SocketChannel.keyFor to behave
|
502
|
+
* erroneously under some versions of Glassfish. (Glassfish versions 2.1.1 and
|
503
|
+
* 3.0 or later are not affected.) A possible workaround for v2.0 is to add the
|
504
|
+
* following to the appropriate section of your Glassfish config/domain.xml
|
505
|
+
* file:
|
506
|
+
*
|
507
|
+
* <jvm-options>-Dcom.sun.enterprise.server.ss.ASQuickStartup=false</jvm-options>
|
508
|
+
*
|
509
|
+
* See the following pages for more information:
|
510
|
+
*
|
511
|
+
* - https://glassfish.dev.java.net/issues/show_bug.cgi?id=3027
|
512
|
+
* - http://docs.sun.com/app/docs/doc/820-4276/knownissuessges?a=view
|
513
|
+
* - http://bugs.sun.com/view_bug.do?bug_id=6562829
|
514
|
+
*
|
515
|
+
********************************************************************************
|
516
|
+
EOF
|
517
|
+
$stderr.puts message
|
518
|
+
raise RuntimeError.new("Erroneous Java/Glassfish SocketChannel.keyFor detected. See the error log and https://glassfish.dev.java.net/issues/show_bug.cgi?id=3027")
|
519
|
+
end
|
520
|
+
|
491
521
|
class SocketChannelWrapper
|
492
522
|
def initialize(master, channel) # :nodoc:
|
493
523
|
@master = master
|
metadata
CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
|
|
4
4
|
prerelease: false
|
5
5
|
segments:
|
6
6
|
- 0
|
7
|
-
-
|
7
|
+
- 8
|
8
8
|
- 0
|
9
|
-
version: 0.
|
9
|
+
version: 0.8.0
|
10
10
|
platform: java
|
11
11
|
authors:
|
12
12
|
- Dwayne Litzenberger
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2010-03-
|
17
|
+
date: 2010-03-30 00:00:00 -04:00
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|