[#30679] IO.popen doesn't fail for non-existent command — nobu@...
なかだです。
4 messages
2007/04/03
[#30681] IO.popen("-") with no fork — Nobuyoshi Nakada <nobu@...>
なかだです。
13 messages
2007/04/03
[#30685] Re: IO.popen("-") with no fork
— "U.Nakamura" <usa@...>
2007/04/04
こんにちは、なかむら(う)です。
[#30686] Re: IO.popen("-") with no fork
— Yukihiro Matsumoto <matz@...>
2007/04/04
Hi,
[#30687] Re: IO.popen("-") with no fork
— Nobuyoshi Nakada <nobu@...>
2007/04/04
なかだです。
[#30688] Re: IO.popen("-") with no fork
— Yukihiro Matsumoto <matz@...>
2007/04/04
まつもと ゆきひろです
[#30722] JSON ライブラリの取り込み — "NARUSE, Yui" <naruse@...>
naruseです。
20 messages
2007/04/21
[#30723] Re: JSON ライブラリの取り込み
— "Akinori MUSHA" <knu@...>
2007/04/21
At Sat, 21 Apr 2007 12:27:47 +0900,
[#30724] Re: JSON ライブラリの取り込み
— "NAKAMURA, Hiroshi" <nakahiro@...>
2007/04/21
-----BEGIN PGP SIGNED MESSAGE-----
[#30729] Re: Ruby 1.9: multiple splats on rvalues in parallel assignment — SASADA Koichi <ko1@...>
ささだです.
6 messages
2007/04/26
[#30730] Re: Ruby 1.9: multiple splats on rvalues in parallel assignment
— Yukihiro Matsumoto <matz@...>
2007/04/26
まつもと ゆきひろです
[ruby-dev:30680] Re: IO.popen doesn't fail for non-existent command
From:
Nobuyoshi Nakada <nobu@...>
Date:
2007-04-03 15:34:47 UTC
List:
ruby-dev #30680
なかだです。
At Tue, 3 Apr 2007 19:26:15 +0900,
nobu@ruby-lang.org wrote in [ruby-dev:30679]:
> http://bts.vinelinux.org/guest.cgi?project=VineLinux&action=view_report&id=481
> 「481: ri で command not found: pager」に関連した話ですが、
> IO.popenに存在しないコマンドを指定したときにエラーにならないの
> は、少なくとも1.9でバグだと思います。
1.8用に、ri_display.rbのパッチです。やってることは1.9と同じです。
Index: lib/rdoc/ri/ri_display.rb
===================================================================
--- lib/rdoc/ri/ri_display.rb (revision 12136)
+++ lib/rdoc/ri/ri_display.rb (working copy)
@@ -211,5 +211,30 @@ class DefaultDisplay
def setup_pager
unless @options.use_stdout
- for pager in [ ENV['PAGER'], "less", "more", 'pager' ].compact.uniq
+ pagers = [ ENV['PAGER'], "less", "more", 'pager' ].compact.uniq
+ begin
+ require 'fcntl'
+ if defined?(Fcntl::F_SETFD) and defined?(Fcntl::FD_CLOEXEC)
+ r, w = IO.pipe
+ w.fcntl(Fcntl::F_SETFD, Fcntl::FD_CLOEXEC)
+ unless f = IO.popen("-", "w")
+ r.close
+ for pager in pagers
+ exec(pager) rescue nil
+ end
+ w.write("\0")
+ w.close
+ exit!
+ end
+ w.close
+ w = nil
+ return f unless r.getc
+ f.close
+ pagers.clear
+ end
+ rescue LoadError, Errno::ENOENT, NotImplementedError
+ ensure
+ [r, w].each {|f| (f.close if f and !f.closed?) rescue nil}
+ end
+ for pager in pagers
return IO.popen(pager, "w") rescue nil
end
--
--- 僕の前にBugはない。
--- 僕の後ろにBugはできる。
中田 伸悦