Last active
January 25, 2017 10:05
-
-
Save tagomoris/5bc1b618c5196c693a7b096353eb57e4 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vagrant@vagrant-ubuntu-trusty-64:/vagrant$ ruby hoge.rb | |
{:here=>"rescue", :closed=>true, :error=>#<IOError: stream closed>} | |
vagrant@vagrant-ubuntu-trusty-64:/vagrant$ ruby -e 'puts RUBY_VERSION' | |
2.3.3 | |
vagrant@vagrant-ubuntu-trusty-64:/vagrant$ ruby -v | |
ruby 2.3.3p222 (2016-11-21 revision 56859) [x86_64-linux-gnu] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vagrant@vagrant-ubuntu-trusty-64:/vagrant$ ruby -v | |
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-linux] | |
vagrant@vagrant-ubuntu-trusty-64:/vagrant$ ruby hoge.rb | |
{:here=>"rescue", :closed=>true, :error=>#<IOError: stream closed>} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MBA:fluentd tagomoris$ ruby -v | |
ruby 2.4.0p0 (2016-12-24 revision 57164) [x86_64-darwin15] | |
MBA:fluentd tagomoris$ ruby hoge.rb | |
{:here=>"rescue", :closed=>true, :error=>#<Errno::EBADF: Bad file descriptor>} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
vagrant@vagrant-ubuntu-trusty-64:/vagrant$ ruby -v | |
ruby 2.5.0dev (2017-01-25 trunk 57420) [x86_64-linux] | |
vagrant@vagrant-ubuntu-trusty-64:/vagrant$ ruby hoge.rb | |
{:here=>"rescue", :closed=>false, :error=>#<IOError: stream closed>} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MBA:fluentd tagomoris$ ruby -v | |
ruby 2.5.0dev (2017-01-24 trunk 57413) [x86_64-darwin15] | |
MBA:fluentd tagomoris$ ruby hoge.rb | |
{:here=>"rescue", :closed=>true, :error=>#<Errno::EBADF: Bad file descriptor>} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require 'socket' | |
server = UNIXServer.new('/tmp/yaaaay') | |
thread = Thread.new do | |
begin | |
while sock = server.accept | |
p(here: "accepted", sock: sock) | |
sock.close rescue nil | |
end | |
rescue => e | |
p(here: "rescue", closed: server.closed?, error: e) | |
end | |
end | |
sleep 1 | |
server.close | |
sleep 1 | |
File.delete('/tmp/yaaaay') |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment