Sha256: 64a9706b0afdaa64d2831d7474e2d398dca8d4f66dff95eb9074cce1112cfe72

Contents?: true

Size: 450 Bytes

Versions: 13

Compression:

Stored size: 450 Bytes

Contents

require 'open3'

# popen3 blocks if pipe buffer size overs 64k (depends on system, this is on my Mac)
# the child process waits its buffer to be read, but the parent process waits the child
# process finishes and returns EOF, hence deadlocks

cmd_array = ['./cat_64k.rb']
stdin, out, err, wait_thr = Open3.popen3(*cmd_array)
stdin.close
pid = wait_thr.pid
stdout = out.read
stderr = err.read
exit_code = wait_thr.value.exitstatus

puts 'no deadlock'

Version data entries

13 entries across 13 versions & 1 rubygems

Version Path
frontkick-0.5.7 experiment/popen3_deadlock.rb
frontkick-0.5.6 experiment/popen3_deadlock.rb
frontkick-0.5.5 experiment/popen3_deadlock.rb
frontkick-0.5.4 experiment/popen3_deadlock.rb
frontkick-0.5.3 experiment/popen3_deadlock.rb
frontkick-0.5.2 experiment/popen3_deadlock.rb
frontkick-0.5.1 experiment/popen3_deadlock.rb
frontkick-0.5.0 experiment/popen3_deadlock.rb
frontkick-0.4.9 experiment/popen3_deadlock.rb
frontkick-0.4.8 experiment/popen3_deadlock.rb
frontkick-0.4.7 experiment/popen3_deadlock.rb
frontkick-0.4.6 experiment/popen3_deadlock.rb
frontkick-0.4.5 experiment/popen3_deadlock.rb