File: test_popen.rb

package info (click to toggle)
ruby-posix-spawn 0.3.6-1
  • links: PTS, VCS
  • area: main
  • in suites: wheezy
  • size: 196 kB
  • sloc: ruby: 916; ansic: 286; makefile: 5
file content (18 lines) | stat: -rw-r--r-- 359 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
require 'test/unit'
require 'posix-spawn'

class PopenTest < Test::Unit::TestCase
  include POSIX::Spawn

  def test_popen4
    pid, i, o, e = popen4("cat")
    i.write "hello world"
    i.close
    ::Process.wait(pid)

    assert_equal "hello world", o.read
    assert_equal 0, $?.exitstatus
  ensure
    [i, o, e].each{ |io| io.close rescue nil }
  end
end