mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* process.c (check_exec_redirect): accept :in, :out, :err as redirect
target. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@20467 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
e98e384be0
commit
ca209c80e9
3 changed files with 22 additions and 0 deletions
|
@ -1,3 +1,8 @@
|
||||||
|
Wed Dec 3 21:30:06 2008 Tanaka Akira <akr@fsij.org>
|
||||||
|
|
||||||
|
* process.c (check_exec_redirect): accept :in, :out, :err as redirect
|
||||||
|
target.
|
||||||
|
|
||||||
Wed Dec 3 21:18:27 2008 Tadayoshi Funaba <tadf@dotrb.org>
|
Wed Dec 3 21:18:27 2008 Tadayoshi Funaba <tadf@dotrb.org>
|
||||||
|
|
||||||
* test/ruby/test_rational.rb: revert.
|
* test/ruby/test_rational.rb: revert.
|
||||||
|
|
12
process.c
12
process.c
|
@ -1259,6 +1259,18 @@ check_exec_redirect(VALUE key, VALUE val, VALUE options)
|
||||||
index = EXEC_OPTION_CLOSE;
|
index = EXEC_OPTION_CLOSE;
|
||||||
param = Qnil;
|
param = Qnil;
|
||||||
}
|
}
|
||||||
|
else if (id == rb_intern("in")) {
|
||||||
|
index = EXEC_OPTION_DUP2;
|
||||||
|
param = INT2FIX(0);
|
||||||
|
}
|
||||||
|
else if (id == rb_intern("out")) {
|
||||||
|
index = EXEC_OPTION_DUP2;
|
||||||
|
param = INT2FIX(1);
|
||||||
|
}
|
||||||
|
else if (id == rb_intern("err")) {
|
||||||
|
index = EXEC_OPTION_DUP2;
|
||||||
|
param = INT2FIX(2);
|
||||||
|
}
|
||||||
else {
|
else {
|
||||||
rb_raise(rb_eArgError, "wrong exec redirect symbol: %s",
|
rb_raise(rb_eArgError, "wrong exec redirect symbol: %s",
|
||||||
rb_id2name(id));
|
rb_id2name(id));
|
||||||
|
|
|
@ -306,6 +306,11 @@ class TestProcess < Test::Unit::TestCase
|
||||||
Process.wait Process.spawn(*ECHO["e"], STDOUT=>["out", File::WRONLY|File::CREAT|File::TRUNC, 0644],
|
Process.wait Process.spawn(*ECHO["e"], STDOUT=>["out", File::WRONLY|File::CREAT|File::TRUNC, 0644],
|
||||||
3=>STDOUT, 4=>STDOUT, 5=>STDOUT, 6=>STDOUT, 7=>STDOUT)
|
3=>STDOUT, 4=>STDOUT, 5=>STDOUT, 6=>STDOUT, 7=>STDOUT)
|
||||||
assert_equal("e", File.read("out").chomp)
|
assert_equal("e", File.read("out").chomp)
|
||||||
|
Process.wait Process.spawn(*ECHO["ee"], STDOUT=>["out", File::WRONLY|File::CREAT|File::TRUNC, 0644],
|
||||||
|
3=>0, 4=>:in, 5=>STDIN,
|
||||||
|
6=>1, 7=>:out, 8=>STDOUT,
|
||||||
|
9=>2, 10=>:err, 11=>STDERR)
|
||||||
|
assert_equal("ee", File.read("out").chomp)
|
||||||
File.open("out", "w") {|f|
|
File.open("out", "w") {|f|
|
||||||
h = {STDOUT=>f, f=>STDOUT}
|
h = {STDOUT=>f, f=>STDOUT}
|
||||||
3.upto(30) {|i| h[i] = STDOUT if f.fileno != i }
|
3.upto(30) {|i| h[i] = STDOUT if f.fileno != i }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue