Skip to content

Commit

Permalink
fixup! Separate platform-specific parts of IO::FileDescriptor
Browse files Browse the repository at this point in the history
  • Loading branch information
RX14 committed Dec 5, 2017
1 parent 70bb1e0 commit ccdd6b7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 7 deletions.
4 changes: 0 additions & 4 deletions src/crystal/system/unix/file_descriptor.cr
Original file line number Diff line number Diff line change
Expand Up @@ -57,10 +57,6 @@ module Crystal::System::FileDescriptor
r
end

def fcntl(cmd, arg = 0)
FileDescriptor.fcntl(@fd, cmd, arg)
end

private def system_stat
if LibC.fstat(@fd, out stat) != 0
raise Errno.new("Unable to get stat")
Expand Down
12 changes: 9 additions & 3 deletions src/io/file_descriptor.cr
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,15 @@ class IO::FileDescriptor < IO
self.system_close_on_exec = value
end

def self.fcntl(fd, cmd, arg = 0)
Crystal::System::FileDescriptor.fcntl(fd, cmd, arg)
end
{% unless flag?(:win32) %}
def self.fcntl(fd, cmd, arg = 0)
Crystal::System::FileDescriptor.fcntl(fd, cmd, arg)
end

def fcntl(cmd, arg = 0)
Crystal::System::FileDescriptor.fcntl(@fd, cmd, arg)
end
{% end %}

def stat
system_stat
Expand Down

0 comments on commit ccdd6b7

Please sign in to comment.