Skip to content

Commit

Permalink
Revert std changes
Browse files Browse the repository at this point in the history
  • Loading branch information
asterite committed Dec 16, 2019
1 parent bdb7eec commit 0400a6d
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 23 deletions.
37 changes: 15 additions & 22 deletions spec/std/socket/socket_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -45,30 +45,23 @@ describe Socket do
it "sends messages" do
port = unused_local_port
server = Socket.tcp(Socket::Family::INET6)
begin
server.bind("::1", port)
server.listen
address = Socket::IPAddress.new("::1", port)
spawn do
client = server.accept
begin
client.gets.should eq "foo"
client.puts "bar"
ensure
client.close
end
end
socket = Socket.tcp(Socket::Family::INET6)
begin
socket.connect(address)
socket.puts "foo"
socket.gets.should eq "bar"
ensure
socket.close
end
server.bind("::1", port)
server.listen
address = Socket::IPAddress.new("::1", port)
spawn do
client = server.accept
client.gets.should eq "foo"
client.puts "bar"
ensure
server.close
client.try &.close
end
socket = Socket.tcp(Socket::Family::INET6)
socket.connect(address)
socket.puts "foo"
socket.gets.should eq "bar"
ensure
socket.try &.close
server.try &.close
end

describe "#bind" do
Expand Down
2 changes: 1 addition & 1 deletion src/process.cr
Original file line number Diff line number Diff line change
Expand Up @@ -301,7 +301,7 @@ class Process
private def stdio_to_fd(stdio : Stdio, for dst_io : IO::FileDescriptor) : IO::FileDescriptor
case stdio
when IO::FileDescriptor
stdio.as(IO::FileDescriptor)
stdio
when IO
if dst_io == STDIN
fork_io, process_io = IO.pipe(read_blocking: true)
Expand Down

0 comments on commit 0400a6d

Please sign in to comment.