During my testing, I found that ruby doesn’t create IO object for each
opened file descriptor which are inherited from parent process. So we
have to close all these opened file descriptor except stdin, stdout and
stderr by following way:
3.upto(1023) do |fd| begin if io = IO::new(fd) io.close end rescue end end
But I really don’t like this way. Is there better way that I can find
all opened file descriptors.
And now I am assuming the maximum file no is 1023. Is there any way that
I can get the maximum file no?