New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use blocking IO on a TTY if it can't be reopened #6660

Merged
merged 2 commits into from Sep 5, 2018

Conversation

Projects
None yet
4 participants
@Timbus
Contributor

Timbus commented Sep 4, 2018

Should fix issue #6624

Kinda hard to test though. Doesn't seem to have any regressions at least.

@RX14

This comment has been minimized.

Member

RX14 commented Sep 4, 2018

Probably cleaner to do

path = uninitialized UInt8[256]
ret = LibC.ttyname_r(fd, path, 256)
return new(fd: blocking: true) unless ret == 0

clone_fd = LibC.open(path, LibC::O_RDWR)
return new(fd: blocking: true) if clone_fd == -1

new(clone_fd).tap(&.close_on_exec = true)
@Sija

This comment has been minimized.

Contributor

Sija commented Sep 4, 2018

@RX14 Your example calls are missing fd / clone_fd argument.

Jarrod Funnell

@ysbaddaden ysbaddaden added this to the 0.27.0 milestone Sep 5, 2018

@RX14

RX14 approved these changes Sep 5, 2018

@RX14 RX14 merged commit b697de0 into crystal-lang:master Sep 5, 2018

4 checks passed

ci/circleci: test_darwin Your tests passed on CircleCI!
Details
ci/circleci: test_linux Your tests passed on CircleCI!
Details
ci/circleci: test_linux32 Your tests passed on CircleCI!
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details

RX14 added a commit to RX14/crystal that referenced this pull request Sep 10, 2018

Use blocking IO on a TTY if it can't be reopened (crystal-lang#6660)
* Use blocking IO on a TTY if it can't be reopened

* Simplify tty fallback logic

ezrast pushed a commit to ezrast/crystal that referenced this pull request Oct 2, 2018

Use blocking IO on a TTY if it can't be reopened (crystal-lang#6660)
* Use blocking IO on a TTY if it can't be reopened

* Simplify tty fallback logic

omarroth added a commit to omarroth/crystal that referenced this pull request Nov 5, 2018

Use blocking IO on a TTY if it can't be reopened (crystal-lang#6660)
* Use blocking IO on a TTY if it can't be reopened

* Simplify tty fallback logic
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment