Created
October 23, 2019 19:44
-
-
Save bradland/203aa0d1869db04d828eaa9360e0be5b 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
#!/usr/bin/env ruby | |
# This script establishes a UNIX server socket. | |
# | |
# Expected result: Script should run and immediately exit. | |
# | |
# Actual result: Script fails with Errno::EADDRINUSE error. | |
# | |
# Environment: Windows 10 Pro, WSL, Ubuntu 18.04.2, ruby 2.6.5p114 (2019-10-01 revision 67812) [x86_64-linux-gnu] | |
# | |
# To reproduce: Create a tmp folder, copy this script there, and execute. | |
require 'socket' | |
path = File.expand_path('listen.sock') | |
backlog = 5 | |
s = UNIXServer.new(path) | |
if backlog | |
s.listen backlog | |
else | |
s.listen | |
end | |
File.delete(path) if File.exists?(path) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment