From 0400a6d344f4895ab1fd364be9f778b79040a726 Mon Sep 17 00:00:00 2001 From: Ary Borenszweig Date: Mon, 16 Dec 2019 14:01:13 -0300 Subject: [PATCH] Revert std changes --- spec/std/socket/socket_spec.cr | 37 ++++++++++++++-------------------- src/process.cr | 2 +- 2 files changed, 16 insertions(+), 23 deletions(-) diff --git a/spec/std/socket/socket_spec.cr b/spec/std/socket/socket_spec.cr index dd087f6274ec..b1d3e0c07dfa 100644 --- a/spec/std/socket/socket_spec.cr +++ b/spec/std/socket/socket_spec.cr @@ -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 diff --git a/src/process.cr b/src/process.cr index be37100a3dbe..394a3e780ffe 100644 --- a/src/process.cr +++ b/src/process.cr @@ -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)