0
我想设置一个布尔变量来切换Net::Telnet模块在日志路径,即:红宝石网/远程登录使用布尔切换登录
telnetdebug = false
telnetlog = false
telnetlogfile = '/var/log/mcacheMonitor.telnet.log'
xmr = Net::Telnet.new("Host" => host,
"Timeout" => 10,
"Prompt" => /[#]\z/n,
'Waittime' => 0,
'Dump_log' => telnetdebug ? "mcmsDebug.log" : nil,
'Output_log' => telnetlog ? telnetlogfile : nil)
但是这个代码产生以下错误:
C:/Ruby192/lib/ruby/1.9.1/net/telnet.rb:300:in `initialize': can't convert nil into String (TypeError)
from C:/Ruby192/lib/ruby/1.9.1/net/telnet.rb:300:in `open'
from C:/Ruby192/lib/ruby/1.9.1/net/telnet.rb:300:in `initialize'
from mcw.rb:26:in `new'
from mcw.rb:26:in `<main>'
一个很好的例子“使用源卢克!”。 –