summaryrefslogtreecommitdiff
path: root/test
diff options
context:
space:
mode:
authorkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-24 02:51:24 +0000
committerkosaki <kosaki@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2012-11-24 02:51:24 +0000
commit5611df706e5685fbe03412588d23ee31f13c671d (patch)
treed1cf7f542ba5bd2dfc4cf18e4d71f7ea84989a9e /test
parent82b33551a4ead2fa13120751242c493e2084cada (diff)
* 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
Diffstat (limited to 'test')
-rw-r--r--test/ruby/test_process.rb15
1 files changed, 15 insertions, 0 deletions
diff --git a/test/ruby/test_process.rb b/test/ruby/test_process.rb
index b549b6f770..c4427be33c 100644
--- a/test/ruby/test_process.rb
+++ b/test/ruby/test_process.rb
@@ -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