projects
/
riece
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
|
inline
| side by side (parent:
e3b030c
)
* server.rb: Don't bind @err in execution environment.
author
Daiki Ueno
<ueno@unixuser.org>
Fri, 12 Aug 2005 00:42:26 +0000
(
00:42
+0000)
committer
Daiki Ueno
<ueno@unixuser.org>
Fri, 12 Aug 2005 00:42:26 +0000
(
00:42
+0000)
lisp/ChangeLog
patch
|
blob
|
history
lisp/server.rb
patch
|
blob
|
history
diff --git
a/lisp/ChangeLog
b/lisp/ChangeLog
index
1329beb
..
31e4822
100644
(file)
--- a/
lisp/ChangeLog
+++ b/
lisp/ChangeLog
@@
-1,3
+1,7
@@
+2005-08-12 Daiki Ueno <ueno@unixuser.org>
+
+ * server.rb: Don't bind @err in execution environment.
+
2005-08-11 Daiki Ueno <ueno@unixuser.org>
* server.rb: Connect $stdout and $stderr to StringIO objects.
2005-08-11 Daiki Ueno <ueno@unixuser.org>
* server.rb: Connect $stdout and $stderr to StringIO objects.
diff --git
a/lisp/server.rb
b/lisp/server.rb
index
2619dcf
..
24f65ee
100644
(file)
--- a/
lisp/server.rb
+++ b/
lisp/server.rb
@@
-4,22
+4,11
@@
require 'thread'
require 'stringio'
class Server
require 'stringio'
class Server
- module B
- def output(s)
- @out.puts("# output #{Thread.current[:rubyserv_name]} #{s}\r\n")
- end
- module_function :output
- end
-
def initialize
@out = $stdout
@err = $stderr
$stdout = StringIO.new
$stderr = StringIO.new
def initialize
@out = $stdout
@err = $stderr
$stdout = StringIO.new
$stderr = StringIO.new
- out, err = @out, @err
- B.module_eval do
- @out, @err = out, err
- end
@buf = ''
@que = Queue.new
@buf = ''
@que = Queue.new
@@
-85,9
+74,19
@@
class Server
@out.puts("S name #{name}\r\n")
@out.puts("OK\r\n")
Thread.current[:rubyserv_name] = name
@out.puts("S name #{name}\r\n")
@out.puts("OK\r\n")
Thread.current[:rubyserv_name] = name
+ out = @out
+ e = Module.new
+ e.module_eval do
+ @out = out
+
+ def output(s)
+ @out.puts("# output #{Thread.current[:rubyserv_name]} #{s}\r\n")
+ end
+ module_function :output
+ end
begin
Thread.current[:rubyserv_error] = false
begin
Thread.current[:rubyserv_error] = false
- Thread.current[:rubyserv_response] = eval(r,
B
.module_eval('binding()'))
+ Thread.current[:rubyserv_response] = eval(r,
e
.module_eval('binding()'))
rescue Exception => e
Thread.current[:rubyserv_error] = true
Thread.current[:rubyserv_response] = e.to_s.sub(/\A.*?\n/, '')
rescue Exception => e
Thread.current[:rubyserv_error] = true
Thread.current[:rubyserv_response] = e.to_s.sub(/\A.*?\n/, '')