我在RubyMonk书1CH9.1上演示一个概念的默认代码是这样的。如何关闭打开的文件?显然,我在返回后运行了太多次,现在它返回了这个错误:
# open the file "new-fd" and create a file descriptor:
fd = IO.sysopen("new-fd", "w")
# create a new I/O stream using the file descriptor for "new-fd":
p IO.new(fd)
STDOUT:
class: Errno::EMFILE
message: Too many open files - new-fd
backtrace: RubyMonk:4:in `sysopen'编辑:显然,该站点正在模拟使用FakeFS创建/删除文件。这导致了一些不寻常的行为,比如调用IO.methods而不返回任何内容。网站链接:https://rubymonk.com/learning/books/1-ruby-primer/chapters/42-introduction-to-i-o/lessons/89-streams
发布于 2015-08-06 04:57:59
这里有两件事:
https://stackoverflow.com/questions/31837830
复制相似问题