From: "Berger, Daniel" Date: 2007-12-19T00:09:15+09:00 Subject: Re: Curious warning with IO.popen on Windows > -----Original Message----- > From: Nobuyoshi Nakada [mailto:nobu@ruby-lang.org] > Sent: Monday, December 17, 2007 7:07 PM > To: ruby-core@ruby-lang.org > Subject: Re: Curious warning with IO.popen on Windows > > Hi, > > At Tue, 18 Dec 2007 08:22:20 +0900, > Berger, Daniel wrote in [ruby-core:14126]: > > This code causes a "The process tried to write to a > nonexistent pipe." > > warning when run with -w. > > > > io =IO.popen('date /t') > > io.close > > Why curious? > > That date command tries to write to the pipe, but it has been > closed before it. That is the message from cmd.exe. But I haven't closed it until after the command has finished, have I? Also, Linux does not emit any warning using the same code (replacing 'date /t' with just 'date'). > > However, this code does not: > > > > io = IO.popen('date /t') > > io.gets > > io.close > > Because the output is just one line, and it is read by gets. If io.gets works, then the date output has already been written to the IO object in the IO.popen call, right? So, why would it complain about the pipe being closed? Thanks, Dan This communication is the property of Qwest and may contain confidential or privileged information. Unauthorized use of this communication is strictly prohibited and may be unlawful. If you have received this communication in error, please immediately notify the sender by reply e-mail and destroy all copies of the communication and any attachments.