Keith Fahlgren
8/3/2006 5:12:00 PM
Hey,
We all appreciate the special joy that human contact can bring, but this
is driving me crazy....
Warning: I'll admit upfront that I only do occasionally Ruby programming
on Windows, so this could be a simple issue.
Here's the problem:
1. I run a DRb server on a Windows box to provide access to a
Windows-only program (using system())
2. I hit it from a DRb client
3. The command prompt (DOS) on the server side waits/hangs at
(seemingly) random times until I hit some keyboard keys (like, say
CTRL+B) and then it continues
Why in the world should the server wait for human (keyboard)
intervention?
Notes: It does this if I start it from the DOS command line or by
double-clicking the script.
I can start it and run it properly (without keyboard input) when I run
the system() string in DOS directly
The (simplified) DRB server looks like this:
class FooBar
def to_pdf(fo, pdf)
#security stuff here...
system("#{FO2PDF} #{AH_OPTIONS} -pea -d #{fo.untaint} -o
#{pdf.untaint}")
end
end
require 'drb'
require 'drb/acl'
require 'thread'
PORT = 2775
HOSTNAME = 'some.ip.here'
# Security
acl = ACL.new(%w(deny all
allow localhost
allow some.other.ip
))
$SAFE = 1
DRb.install_acl(acl)
puts "SAFE level at #{$SAFE}"
DRb.start_service("druby://#{HOSTNAME}:#{PORT}", FooBar.new)
# Keep running...
puts "Service up and running..."
DRb.thread.join
Any ideas?
Thanks,
Keith