On Feb 19, 11:56 pm, Daniel Berger <djber... / gmail.com> wrote: > Luis Lavena wrote: > > On Feb 19, 8:02 pm, Daniel Berger <djber... / gmail.com> wrote: > >> Hi all, > > >> Ruby 1.8.6 > >> Windows XP Pro > > >> I tried this standalone snippet: > > >> io = IO.popen('date /t') > > >> Running that with -w I get this warning: > > >> The process tried to write to a nonexistent pipe > > > I got the same without the -w option. > > > This is related to the redirection of stdio and stdout and the > > premature termination of them (in the child process spawn by ruby). > > > If you add a Kernel.gets() or anything that delays the script > > termiantion you wouldn't get the warning. > > So, how do we fix it Luis? > To be more exact, the error message is not coming from ruby itself, but is the output genereated by STDERR from the child process being captured by the console you're running. This is a small example, doing the same thing with FreeBASIC: open pipe "date /t" for input as #1 (compile with fbc.exe) and the output will be: D:\Users\Luis\Desktop>u The process tried to write to a nonexistent pipe. The process tried to write to a nonexistent pipe. The same problem shows when you try to use "echo" and pipes in batch files from time to time, there is no guarantee that the pipe will exist at that time, and ruby is closing itself before the child process can actually execute. Adding a sleep also prevent from getting the warning, but this seems to have been raised in every language or scripting processor (VBScript and PowerShell) too. What are you trying to do? if you're just ignoring the output of the 'date /t', why don't you use backtick syntax? io = `date /t` Using that syntax worked all the time, (from 10 runs, I got 0 error messages). Regards, -- Luis Lavena