Skip to content
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

IO.console is missing with JRuby on Linux aarch64 #40

Closed
PChambino opened this issue Mar 6, 2023 · 1 comment · Fixed by #41
Closed

IO.console is missing with JRuby on Linux aarch64 #40

PChambino opened this issue Mar 6, 2023 · 1 comment · Fixed by #41

Comments

@PChambino
Copy link
Contributor

I am testing this on a Linux aarch64 with JRuby.

I can see the io/console/ffi/stty_console is being loaded based on the warning message:
"io/console on JRuby shells out to stty for most operations"

If I manually require io/console/ffi/native_console it fails due to the platform guard at the top of the file.

However, if I remove that guard it, it loads and works fine in my brief testing.

So I have two questions:

  1. Is there any reason to not allow aarch64 in the io/console/ffi/linux_console guard?

  2. Even if it falls back to io/console/ffi/stty_console, is there any reason not to support IO.console? I think it could return File.new("/dev/tty/", "r+") similar to the one in io/console/ffi/native_console?

@headius
Copy link
Contributor

headius commented Mar 8, 2023

There's no reason not to allow aarch64! Could you put together a PR?

PChambino added a commit to PChambino/io-console that referenced this issue Mar 9, 2023
I am running JRuby on a Linux aarch64.

I can see the `io/console/ffi/stty_console` is being loaded based on the warning message:
"io/console on JRuby shells out to stty for most operations"

If I manually require `io/console/ffi/native_console` it fails due to the
platform guard at the top of the file.

However, if I remove that guard it, it loads and works fine in my brief testing.

In ruby#40, @headius confirmed there is no reason not to allow aarch64, so
adding it in this PR. Closes ruby#40.
PChambino added a commit to PChambino/io-console that referenced this issue Mar 15, 2023
At the moment, this works correctly when `console` method exists, but
when it doesn't exist it actually fails with NameError instead of NoMethodError.

For example, when using JRuby on Linux aarch64 (related ruby#40):
(trimmed IRB output)
```
io/console on JRuby shells out to stty for most operations
irb(main):001:0> IO.console
(irb):1:in `evaluate': undefined method `console' for IO:Class (NoMethodError)
irb(main):003:0> require 'io/console/size'
irb(main):004:0> IO.console_size
uri:classloader:/META-INF/jruby.home/lib/ruby/stdlib/io/console/size.rb:19:in `console_size': undefined local variable or method `console' for IO:Class (NameError)
```

With the change in this PR it works as expected.
headius pushed a commit that referenced this issue Mar 16, 2023
I am running JRuby on a Linux aarch64.

I can see the `io/console/ffi/stty_console` is being loaded based on the warning message:
"io/console on JRuby shells out to stty for most operations"

If I manually require `io/console/ffi/native_console` it fails due to the
platform guard at the top of the file.

However, if I remove that guard it, it loads and works fine in my brief testing.

In #40, @headius confirmed there is no reason not to allow aarch64, so
adding it in this PR. Closes #40.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging a pull request may close this issue.

2 participants