[#47253] unexpected dependencies such as ext/-test-/num2int/depend describes num2int.o depends on numeric.c — Tanaka Akira <akr@...>
気がついたんですが、ext/-test-/num2int/depend など、
3 messages
2013/04/12
[#47269] [ruby-trunk - Bug #8292][Open] README.EXT.ja の Data_Wrap_Struct の所の文章がコード片と一致しない (patch) — "metanest (Makoto Kishimoto)" <redmine@...>
4 messages
2013/04/19
[#47310] RubySource.com からのインタビュー — Yusuke Endoh <mame@...>
遠藤です。ご無沙汰してます。
6 messages
2013/04/30
[#47326] Re: RubySource.com からのインタビュー
— Yusuke Endoh <mame@...>
2013/05/07
遠藤です。
[ruby-dev:47236] [ruby-trunk - Feature #3348] rubyspec: Kernel.spawn redirects both STDERR and STDOUT to the given name ERROR
From:
"naruse (Yui NARUSE)" <naruse@...>
Date:
2013-04-07 12:34:10 UTC
List:
ruby-dev #47236
Issue #3348 has been updated by naruse (Yui NARUSE).
Target version changed from next minor to current: 2.1.0
----------------------------------------
Feature #3348: rubyspec: Kernel.spawn redirects both STDERR and STDOUT to the given name ERROR
https://bugs.ruby-lang.org/issues/3348#change-38330
Author: mame (Yusuke Endoh)
Status: Assigned
Priority: Low
Assignee: mame (Yusuke Endoh)
Category:
Target version: current: 2.1.0
=begin
遠藤です。
spawn のリダイレクトの引数で :out => "foo" としたとき、ファイル foo が存在
しなければ作ってくれますが、[:out, :err] => "foo" だと作ってくれません。
ruby -e 'pid = spawn("echo", "foo", [:out, :err] => "foo"); Proces.wait pid'
これは意図的でしょうか。
うっとうしいことに、rubyspec がこの挙動に依存して失敗するようになりました。
配列の中がすべて :out か :err だったら O_CREAT|O_TRUNC にするパッチです。
反対がなければコミットします。
diff --git a/process.c b/process.c
index 9e52392..4ca6ed3 100644
--- a/process.c
+++ b/process.c
@@ -1342,7 +1342,19 @@ check_exec_redirect(VALUE key, VALUE val, VALUE options)
key = check_exec_redirect_fd(key);
if (FIXNUM_P(key) && (FIX2INT(key) == 1 || FIX2INT(key) == 2))
flags = INT2NUM(O_WRONLY|O_CREAT|O_TRUNC);
- else
+ else if (TYPE(key) == T_ARRAY) {
+ int i;
+ for (i = 0; i < RARRAY_LEN(key); i++) {
+ VALUE v = RARRAY_PTR(key)[i];
+ VALUE fd = check_exec_redirect_fd(v);
+ if (FIX2INT(fd) != 1 && FIX2INT(fd) != 2) break;
+ }
+ if (i == RARRAY_LEN(key))
+ flags = INT2NUM(O_WRONLY|O_CREAT|O_TRUNC);
+ else
+ flags = INT2NUM(O_RDONLY);
+ }
+ else
flags = INT2NUM(O_RDONLY);
perm = INT2FIX(0644);
param = hide_obj(rb_ary_new3(3, hide_obj(rb_str_dup(path)),
--
Yusuke Endoh <mame@tsg.ne.jp>
=end
--
http://bugs.ruby-lang.org/