Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: rubinius/rubinius
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: a2d76f56c3ce
Choose a base ref
...
head repository: rubinius/rubinius
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 3a4c3fda1dec
Choose a head ref
  • 5 commits
  • 3 files changed
  • 1 contributor

Commits on Oct 10, 2015

  1. Remove converting to negative fd

    Convert a fd to -(fd + 1) if its a Fixnum seems wrong.
    Negative fds's are mostly invalid.
    tak1n committed Oct 10, 2015
    Copy the full SHA
    c8ce8a7 View commit details
  2. Copy the full SHA
    008cd1e View commit details
  3. remove obsolete assignment

    tak1n committed Oct 10, 2015
    Copy the full SHA
    cbe875e View commit details
  4. change => to is

    tak1n committed Oct 10, 2015
    Copy the full SHA
    29674df View commit details

Commits on Oct 15, 2015

  1. Merge branch '2.2' into fix-process-spawn

    * 2.2:
      allow nil,true,false to be modified when frozen
    tak1n committed Oct 15, 2015
    Copy the full SHA
    3a4c3fd View commit details
Showing with 22 additions and 25 deletions.
  1. +1 −2 kernel/common/process_mirror.rb
  2. +21 −13 spec/ruby/shared/process/spawn.rb
  3. +0 −10 spec/tags/ruby/core/io/popen_tags.txt
3 changes: 1 addition & 2 deletions kernel/common/process_mirror.rb
Original file line number Diff line number Diff line change
@@ -185,8 +185,7 @@ def convert_to_fd(obj, target)
[obj[0], File::RDONLY, 0644]
when 2
if obj[0] == :child
fd = convert_to_fd obj[1], target
fd.kind_of?(::Fixnum) ? -(fd + 1) : fd
convert_to_fd obj[1], target
else
[obj[0], convert_file_mode(obj[1]), 0644]
end
34 changes: 21 additions & 13 deletions spec/ruby/shared/process/spawn.rb
Original file line number Diff line number Diff line change
@@ -229,19 +229,19 @@
end.should output_to_fd(Process.getpgid(Process.pid).to_s)
end

it "joins the current process if :pgroup => false" do
it "joins the current process if :pgroup is false" do
lambda do
Process.wait @object.spawn(ruby_cmd("print Process.getpgid(Process.pid)"), :pgroup => false)
end.should output_to_fd(Process.getpgid(Process.pid).to_s)
end

it "joins the current process if :pgroup => nil" do
it "joins the current process if :pgroup is nil" do
lambda do
Process.wait @object.spawn(ruby_cmd("print Process.getpgid(Process.pid)"), :pgroup => nil)
end.should output_to_fd(Process.getpgid(Process.pid).to_s)
end

it "joins a new process group if :pgroup => true" do
it "joins a new process group if :pgroup is true" do
process = lambda do
Process.wait @object.spawn(ruby_cmd("print Process.getpgid(Process.pid)"), :pgroup => true)
end
@@ -250,7 +250,7 @@
process.should output_to_fd(/\d+/)
end

it "joins a new process group if :pgroup => 0" do
it "joins a new process group if :pgroup is 0" do
process = lambda do
Process.wait @object.spawn(ruby_cmd("print Process.getpgid(Process.pid)"), :pgroup => 0)
end
@@ -259,7 +259,7 @@
process.should output_to_fd(/\d+/)
end

it "joins the specified process group if :pgroup => pgid" do
it "joins the specified process group if :pgroup is pgid" do
lambda do
Process.wait @object.spawn(ruby_cmd("print Process.getpgid(Process.pid)"), :pgroup => 123)
end.should_not output_to_fd("123")
@@ -334,48 +334,56 @@

# redirection

it "redirects STDOUT to the given file descriptior if :out => Fixnum" do
it "redirects STDOUT to the given file descriptior if :out is Fixnum" do
File.open(@name, 'w') do |file|
lambda do
Process.wait @object.spawn(ruby_cmd("print :glark"), :out => file.fileno)
end.should output_to_fd("glark", file)
end
end

it "redirects STDOUT to the given file if :out => IO" do
it "redirects STDOUT to the given file if :out is IO" do
File.open(@name, 'w') do |file|
lambda do
Process.wait @object.spawn(ruby_cmd("print :glark"), :out => file)
end.should output_to_fd("glark", file)
end
end

it "redirects STDOUT to the given file if :out => String" do
it "redirects STDOUT to the given file if :out is String" do
Process.wait @object.spawn(ruby_cmd("print :glark"), :out => @name)
@name.should have_data("glark")
end

it "redirects STDERR to the given file descriptior if :err => Fixnum" do
it "redirects STDERR to the given file descriptior if :err is Fixnum" do
File.open(@name, 'w') do |file|
lambda do
Process.wait @object.spawn(ruby_cmd("STDERR.print :glark"), :err => file.fileno)
end.should output_to_fd("glark", file)
end
end

it "redirects STDERR to the given file descriptor if :err => IO" do
it "redirects STDERR to the given file descriptor if :err is IO" do
File.open(@name, 'w') do |file|
lambda do
Process.wait @object.spawn(ruby_cmd("STDERR.print :glark"), :err => file)
end.should output_to_fd("glark", file)
end
end

it "redirects STDERR to the given file if :err => String" do
it "redirects STDERR to the given file if :err is String" do
Process.wait @object.spawn(ruby_cmd("STDERR.print :glark"), :err => @name)
@name.should have_data("glark")
end

it "redirects STDERR to child STDOUT if :err is [:child, :out]" do
File.open(@name, 'w') do |file|
lambda do
Process.wait @object.spawn(ruby_cmd("STDERR.print :glark"), :out => file, :err => [:child, :out])
end.should output_to_fd("glark", file)
end
end

it "redirects both STDERR and STDOUT to the given file descriptior" do
File.open(@name, 'w') do |file|
lambda do
@@ -402,7 +410,7 @@
@name.should have_data("")
end

context "when passed :close_others => true" do
context "when passed :close_others is true" do
before :each do
@output = tmp("spawn_close_others_true")
@options = { :close_others => true }
@@ -445,7 +453,7 @@
end
end

context "when passed :close_others => false" do
context "when passed :close_others is false" do
before :each do
@output = tmp("spawn_close_others_false")
@options = { :close_others => false }
10 changes: 0 additions & 10 deletions spec/tags/ruby/core/io/popen_tags.txt

This file was deleted.