[Ruby] Re[2]: [Ruby] IO.popen("cmd").readlines.grep(/str/) оставляет зомби

Alexander Bokovoy a.bokovoy at sam-solutions.net
Wed Apr 23 18:54:57 MSD 2003


On Wed, Apr 23, 2003 at 06:52:39PM +0400, SoNaR wrote:
> vi> Вроде теперь не зомбится.
> 
> А чего все таки блоком не стал делать... типа:
> IO::popen("iptables -nvL FORWARD"){ |ipt|
>     ipt1=ipt.grep(/192.168.1.244/)
> }
> 
> Так зомбится будет?
Не будет, но тут другая проблема -- возврат значения из блока для popen не
предусматривается.
Так что придется делать так:

ipt_result=nil
 IO::popen("iptables -nvL FORWARD"){ |ipt|
     ipt_result ||=ipt.grep(/192.168.1.244/)
 }

-- 
/ Alexander Bokovoy
---
We all live under the same sky, but we don't all have the same horizon.
		-- Dr. Konrad Adenauer



More information about the Ruby mailing list