Actions
Feature #3348
closedrubyspec: Kernel.spawn redirects both STDERR and STDOUT to the given name ERROR
Feature #3348:
rubyspec: Kernel.spawn redirects both STDERR and STDOUT to the given name ERROR
Description
=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
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
Actions