Skip to content

Clean up structure of io/console and avoid stty on Windows. - #4590

Merged
headius merged 1 commit into
jruby:jruby-1_7from
headius:cleanup_io_console
May 8, 2017
Merged

Clean up structure of io/console and avoid stty on Windows.#4590
headius merged 1 commit into
jruby:jruby-1_7from
headius:cleanup_io_console

Conversation

@headius

@headius headius commented May 5, 2017

Copy link
Copy Markdown
Member

This should fix #3989.

I have restructured io/console to be more modular and now force Windows to always use the stubbed version...never the stty version.

Other platforms should work as they did before, but the code is a bit easier to follow now.

@headius headius added this to the JRuby 1.7.27 milestone May 5, 2017
Fixes jruby#3989.

* Restructure the different impls of console into their own files.
* Always use stubbed version on Windows.
* Cascade from native to stty to stubbed on other platforms.
@headius

headius commented May 5, 2017

Copy link
Copy Markdown
Member Author

Request review from @kares, @enebo. This is almost structurally identical to the old one, but the old logic was hard to follow and had unusual guards (like the ttymode defined check) that I did not carry over.

I believe the new logic is cleaned and more appropriate:

  1. If Windows, use stubbed always.
  2. If Linux or BSD, attempt to use native; if that fails, continue with (3)
  3. Attempt to use stty. If that fails, fall back to stubbed.

@kares

kares commented May 6, 2017

Copy link
Copy Markdown
Member

👍 such a cleanup would be good to have on 9K (pretty much all in one file)
although I am not sure how deep its modified compared to the stock version for MRI (due stdlib imports).

@headius

headius commented May 6, 2017

Copy link
Copy Markdown
Member Author

In MRI, io/console is written entirely in C. Part of this reorg is to get files like linux_console.rb out of the io load namespace. I realize I have added a new namespace with JRuby-specific files, but I think it is isolated pretty well.

I will get this into 9k as well since they're both from the same sources.

@headius
headius merged commit 59d305e into jruby:jruby-1_7 May 8, 2017
@headius
headius deleted the cleanup_io_console branch May 8, 2017 17:11
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants