Skip to content

Fix Crystal::System::FileDescriptor to use @fd ivar directly#6703

Merged
RX14 merged 2 commits intocrystal-lang:masterfrom
straight-shoota:jm/fix/filedescriptor-use-ivar
Sep 12, 2018
Merged

Fix Crystal::System::FileDescriptor to use @fd ivar directly#6703
RX14 merged 2 commits intocrystal-lang:masterfrom
straight-shoota:jm/fix/filedescriptor-use-ivar

Conversation

@straight-shoota
Copy link
Copy Markdown
Member

A method fd is actually not exposed in Crystal::System::FileDescriptor itself, so accessing the ivar directly is better and consistent with the rest of the module (everywhere else in this file it's @fd).

# dup doesn't copy the CLOEXEC flag, so copy it manually using dup3
flags = other.close_on_exec? ? LibC::O_CLOEXEC : 0
if LibC.dup3(other.fd, self.fd, flags) == -1
if LibC.dup3(other.@fd, self.@fd, flags) == -1
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might drop the self.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch, it looks weird.

@RX14 RX14 added this to the 0.27.0 milestone Sep 12, 2018
@RX14 RX14 merged commit 74fe37c into crystal-lang:master Sep 12, 2018
@straight-shoota straight-shoota deleted the jm/fix/filedescriptor-use-ivar branch September 12, 2018 16:39
ezrast pushed a commit to ezrast/crystal that referenced this pull request Oct 2, 2018
…-lang#6703)

* Fix Crystal::System::FileDescriptor to use @fd ivar directly

* fixup! Fix Crystal::System::FileDescriptor to use @fd ivar directly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants