Skip to content

Commit

Permalink
Fix Socket#tty? to false on Windows (#13175)
Browse files Browse the repository at this point in the history
  • Loading branch information
Blacksmoke16 authored Mar 13, 2023
1 parent 03e70e2 commit b992e0b
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions spec/std/socket/socket_spec.cr
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,12 @@ describe Socket, tags: "network" do
end
end

describe "#tty?" do
it "with non TTY" do
Socket.new(Socket::Family::INET, Socket::Type::STREAM, Socket::Protocol::TCP).tty?.should be_false
end
end

pending_win32 ".accept" do
client_done = Channel(Nil).new
server = Socket.new(Socket::Family::INET, Socket::Type::STREAM, Socket::Protocol::TCP)
Expand Down
2 changes: 1 addition & 1 deletion src/crystal/system/win32/socket.cr
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,7 @@ module Crystal::System::Socket
end

private def system_tty?
LibC.isatty(fd) == 1
false
end

private def unbuffered_read(slice : Bytes)
Expand Down

0 comments on commit b992e0b

Please sign in to comment.