Skip to content

Instantly share code, notes, and snippets.

@rdj
Created November 24, 2012 07:47
Show Gist options
  • Save rdj/4138810 to your computer and use it in GitHub Desktop.
Save rdj/4138810 to your computer and use it in GitHub Desktop.
deploy@foxtrot:~$ uname -a
Linux XXXXXXX 2.6.35.4-rscloud #8 SMP Mon Sep 20 15:54:
33 UTC 2010 x86_64 GNU/Linux
deploy@foxtrot:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 10.04.3 LTS
Release: 10.04
Codename: lucid
1.9.3p327 :002 > puts RUBY_VERSION
1.9.3
=> nil
1.9.3p327 :003 > (1..10).each do |i|
1.9.3p327 :004 > passes = true
1.9.3p327 :005?> begin
1.9.3p327 :006 > (rp, wp) = IO.pipe
1.9.3p327 :007?> wp.write_nonblock ("F" * i) while(select [],
wp], [], 0)
1.9.3p327 :008?> rescue Errno::EAGAIN
1.9.3p327 :009?> puts "#{i}: FAIL"
1.9.3p327 :010?> passes = false
1.9.3p327 :011?> ensure
1.9.3p327 :012 > rp.close
1.9.3p327 :013?> wp.close
1.9.3p327 :014?> end
1.9.3p327 :015?> puts "#{i}: PASS" if passes
1.9.3p327 :016?> end
1: PASS
2: PASS
3: PASS
4: PASS
5: PASS
6: PASS
7: PASS
8: PASS
9: PASS
10: PASS
=> 1..10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment