From: Sebastian Yepes ESN Date: 2008-11-26T22:16:54+09:00 Subject: multiplatform pipe open? Hi all, I'm starting with Ruby and i am trying to migrate some Perl scripts to Ruby, but cant get pipes with open to work like in perl. What's the Right way to make open "pipes, stdin,stdout" work in all OS platforms, with no external gems? I have tried the 'fh = IO.popen("/bin/console_programe","w+")', but don't understand why i need to use the method "close_write". Thanks for any help. Perl script: --------- &cons_connect; &cons_register; &cons_listener; sub cons_connect { local (*CONS_READ, *CONS_WRITE); open2(\*CONS_READ, \*CONS_WRITE, "/bin/console_programe"); my $line = ; if($line =~ /xml/){ print "CONNECTED CONNECT TO CONS" }else{ print "CANNOT CONNECT TO CONS"; } } sub cons_register { my(@SERVICES) = @_; print CONS_WRITE "\n"; foreach my $service ( @SERVICES ){ print CONS_WRITE "\n$service\n\n"; } print CONS_WRITE "\n"; my $line = ; if($line =~ /\n/){ print "REGISTRATION: OK"; }else{ print "REGISTRATION: NOK"; } } sub cons_listener { while ($line = ){ # Processing the... } } -------------- -- Posted via http://www.ruby-forum.com/.