* process.c (proc_getsid): adds new method for getting session id.

Contributed from fumiyas (Fumiyasu SATOH). Thank you!
  [Feature #6757] [ruby-dev:45977]
* configure.in: adds getsid check.
* test/ruby/test_process.rb (TestProcess#test_setsid): new test
  for the above.
* NEWS: news for the above.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@37825 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
kosaki 2012-11-24 02:51:24 +00:00
parent 82b33551a4
commit 5611df706e
5 changed files with 65 additions and 1 deletions

View file

@ -1558,4 +1558,19 @@ class TestProcess < Test::Unit::TestCase
}
end if File.executable?("/bin/sh")
def test_setsid
return unless Process.respond_to?(:setsid)
return unless Process.respond_to?(:getsid)
IO.popen(["./ruby-trunk", "-e", <<EOS]) do|io|
Marshal.dump(Process.getsid, STDOUT)
newsid = Process.setsid
Marshal.dump(newsid, STDOUT)
STDOUT.flush
EOS
assert_equal(Marshal.load(io), Process.getsid)
assert_equal(Marshal.load(io), Process.getsid(io.pid))
end
end
end