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,
This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.