192 Commits
Author SHA1 Message Date
Nobuyoshi Nakada b70f5afb68 [ruby/io-wait] Remove IO#nread and `IO#ready?
https://github.com/ruby/io-wait/commit/1decadc7f9
2025-11-12 13:48:18 +00:00
Nobuyoshi Nakada 12350eb9e0 [Bug #21625] Allow io/wait methods with IO#ungetc in text mode 2025-10-29 17:23:00 +09:00
Takashi Kokubun de6df7508d test_io_wait.rb: Increase a timeout for a flaky test
like 68682a5d2b

https://github.com/ruby/ruby/actions/runs/17417763247/job/49449895757?pr=14433
2025-09-02 16:21:08 -07:00
Takashi Kokubun 68682a5d2b Increase timeout for failing tests
https://github.com/ruby/ruby/actions/runs/16969921157/job/48103809963
https://github.com/ruby/ruby/actions/runs/16969655024/job/48102876839
2025-08-14 11:23:12 -07:00
Nobuyoshi Nakada d3d249b904 [ruby/io-console] Fix removing unexpected control chars
`cc` is created as `"\C-x"`, it is a String since ruby 1.9.

https://github.com/ruby/io-console/commit/65c9266feb
2025-07-01 08:36:19 +00:00
Nobuyoshi Nakada 06f9fc20ec [ruby/io-console] Use host_os in RbConfig instead of RUBY_PLATFORM for JRuby
https://github.com/ruby/io-console/commit/f8b33f38ae
2025-07-01 08:32:29 +00:00
Nobuyoshi Nakada 64a52c25fe [ruby/io-console] Fix a name error
https://github.com/ruby/io-console/commit/e0398acad4
2025-06-27 07:25:37 +00:00
Nobuyoshi Nakada 528b75cc14 [ruby/io-console] Ignore printed control char
It's something we don't expect and might be coming from somewhere
else.

https://github.com/ruby/io-console/commit/c5e47a900c
2025-06-27 07:23:09 +00:00
Nobuyoshi Nakada 495613ffd3 [ruby/io-console] Revert "Ignore ^C at interrupt"
This reverts commit https://github.com/ruby/io-console/commit/f0646b2b6ae3.

https://github.com/ruby/io-console/commit/2e0e01263a
2025-06-27 07:23:09 +00:00
Nobuyoshi Nakada ce38cba528 Merge blocks for the same condition 2025-06-23 11:08:22 +09:00
Nobuyoshi Nakada d9efc56c16 [ruby/io-console] Ignore ^C at interrupt
It's something we don't expect and might be coming from somewhere
else.

https://github.com/ruby/io-console/commit/f0646b2b6a
2025-06-20 09:39:29 +00:00
Hiroshi SHIBATA 6609ba0514 [ruby/io-wait] Alias value or join to take in old Ruby
https://github.com/ruby/io-wait/commit/cf84aea70d
2025-06-03 08:24:14 +00:00
Hiroshi SHIBATA c6c51569cb [ruby/io-console] Alias value or join to take in old Ruby
https://github.com/ruby/io-console/commit/7106d05219
2025-06-03 07:02:18 +00:00
Koichi Sasada ef2bb61018 Ractor::Port
* Added `Ractor::Port`
  * `Ractor::Port#receive` (support multi-threads)
  * `Rcator::Port#close`
  * `Ractor::Port#closed?`
* Added some methods
  * `Ractor#join`
  * `Ractor#value`
  * `Ractor#monitor`
  * `Ractor#unmonitor`
* Removed some methods
  * `Ractor#take`
  * `Ractor.yield`
* Change the spec
  * `Racotr.select`

You can wait for multiple sequences of messages with `Ractor::Port`.

```ruby
ports = 3.times.map{ Ractor::Port.new }
ports.map.with_index do |port, ri|
  Ractor.new port,ri do |port, ri|
    3.times{|i| port << "r#{ri}-#{i}"}
  end
end

p ports.each{|port| pp 3.times.map{port.receive}}

```

In this example, we use 3 ports, and 3 Ractors send messages to them respectively.
We can receive a series of messages from each port.

You can use `Ractor#value` to get the last value of a Ractor's block:

```ruby
result = Ractor.new do
  heavy_task()
end.value
```

You can wait for the termination of a Ractor with `Ractor#join` like this:

```ruby
Ractor.new do
  some_task()
end.join
```

`#value` and `#join` are similar to `Thread#value` and `Thread#join`.

To implement `#join`, `Ractor#monitor` (and `Ractor#unmonitor`) is introduced.

This commit changes `Ractor.select()` method.
It now only accepts ports or Ractors, and returns when a port receives a message or a Ractor terminates.

We removes `Ractor.yield` and `Ractor#take` because:
* `Ractor::Port` supports most of similar use cases in a simpler manner.
* Removing them significantly simplifies the code.

We also change the internal thread scheduler code (thread_pthread.c):
* During barrier synchronization, we keep the `ractor_sched` lock to avoid deadlocks.
  This lock is released by `rb_ractor_sched_barrier_end()`
  which is called at the end of operations that require the barrier.
* fix potential deadlock issues by checking interrupts just before setting UBF.

https://bugs.ruby-lang.org/issues/21262
2025-05-31 04:01:33 +09:00
Hiroshi SHIBATA 8b4017584b Use EnvUtil.apply_timeout_scale for test_io_wait.rb 2025-04-30 16:59:16 +09:00
Hiroshi SHIBATA 6bd5a51ab5 Removed Solaris conditions from test files
We no longer execute those files with Solaris platforms.
2025-04-02 16:24:47 +09:00
Naoto Ono db4ea95219 [Bug #20682] Add sleep 0.1 to stabilize flaky failures on macOS (#12829)
[Bug #20682] Add `sleep 0.1` to stabilize flaky failures on macOS
2025-02-28 09:32:36 +00:00
Nobuyoshi Nakada 8ec58a91f7 [ruby/io-console] Add IO#ttyname that returns the tty name or nil
https://github.com/ruby/io-console/commit/fdad351501
2024-12-02 08:03:30 +00:00
Nobuyoshi Nakada 4a1ea9b63a [ruby/io-console] Store console IO in Ractor-local storage
Ractor requires a shareable class has shareable constants only, but IO
is not shareable unless frozen.

https://github.com/ruby/io-console/commit/65e0ff895c
2024-08-31 08:43:59 +00:00
Nobuyoshi Nakada 365ededfdf [ruby/io-console] io-console is considered Ractor-safe
https://github.com/ruby/io-console/commit/b1adc15af7
2024-08-31 05:46:05 +00:00
Nobuyoshi Nakada 13f04e5beb [ruby/io-console] Load the built extension library in noctty tests
https://github.com/ruby/io-console/commit/74c78afc24
2024-04-10 09:10:50 +00:00
Nobuyoshi Nakada 86547fd69d [ruby/io-console] Move the condition to omit to command line option
https://github.com/ruby/io-console/commit/32583460e1
2024-01-30 19:19:23 +09:00
Nobuyoshi Nakada c2cb5b4463 [ruby/io-console] Move the condition to omit outside the method
https://github.com/ruby/io-console/commit/8b9b5b611a
2024-01-30 19:19:23 +09:00
Takashi Kokubun cc86fa8416 Skip an unstable test on MinGW
This test fails fairly frequently on MinGW:
https://github.com/ruby/ruby/actions/runs/7195712496/job/19598924253#step:11:168
https://github.com/ruby/ruby/actions/runs/7191246799/job/19585627182#step:11:168

and we aren't actively working on stabilizing tests for MinGW.
2023-12-13 09:40:54 -08:00
Nobuyoshi Nakada 818ba30ee9 [ruby/io-console] Avoid the influence of special variable $/
https://github.com/ruby/io-console/commit/5f71354332
2023-08-18 03:55:04 +00:00
Nobuyoshi Nakada 540cf43205 [ruby/io-console] Enable getpass methods always
https://github.com/ruby/io-console/commit/57f9649df4
2023-08-18 03:55:02 +00:00
Samuel Williams d20bd06a97 Remove require 'io/wait' where it's no longer necessary. (#6932)
* Remove `require 'io/wait'` as it's part of core now.

* Update ruby specs using version gates.

* Add note about why it's conditional.
2022-12-15 11:37:01 +13:00
Nobuyoshi Nakada 21ed929e15 [ruby/io-console] Omit on JRuby
https://github.com/ruby/io-console/commit/9122c181eb
2022-12-02 10:33:36 +00:00
Nobuyoshi Nakada 678bcfcaa6 [ruby/io-console] Check rawmode option names strictly
https://github.com/ruby/io-console/commit/aa8fc7e947
2022-12-02 10:33:35 +00:00
Alan Wu 7f269a3c2d Fix io/console test for --with-static-linked-ext
The tests looks for the .so file, which doesn't exist when the extension
is statically linked. In that situation it passes -I to ruby with
nothing after it which ate the -rio/console argument.
2022-11-18 18:50:34 -05:00
Takashi Kokubun 1825d3673f Skip test_wait on MinGW CI
This test has been unstable, and it seems like we're not interested in
fixing that for MinGW.
https://github.com/ruby/ruby/actions/runs/3073317191/jobs/4965373284
2022-09-17 22:08:36 +09:00
Hiroshi SHIBATA 892fe9bbba omit all assertions at TestIO_Console#test_intr when running with FreeBSD 2022-08-23 12:49:46 +09:00
Hiroshi SHIBATA d448ecc7b1 Fix the missing brackets 2022-07-28 19:25:52 +09:00
Hiroshi SHIBATA 202ce7de01 test_io_console.rbL399 is also randomly failing same as bfc697f1e2 2022-07-28 19:14:01 +09:00
Samuel Williams d281347abb [ruby/io-wait] Fix usage of assert_raises -> assert_raise. (https://github.com/ruby/io-wait/pull/20)
https://github.com/ruby/io-wait/commit/c5c6abbb5c
2022-06-25 17:12:26 +09:00
git 7e68762446 * remove trailing spaces. [ci skip] 2022-06-25 16:22:07 +09:00
Samuel Williams f9c8d80883 [ruby/io-wait] Don't add IO#wait* methods when RUBY_IO_WAIT_METHODS is defined by Ruby. (https://github.com/ruby/io-wait/pull/19)
* Fix return value compatibility with Ruby 2.x.

* Don't add `IO#wait*` methods in Ruby 3.2+.

https://github.com/ruby/io-wait/commit/54c504d089
2022-06-25 16:21:54 +09:00
Yusuke Endoh bfc697f1e2 test/io/console/test_io_console.rb: parens needed 2022-03-08 17:40:02 +09:00
Yusuke Endoh 17e09f033c Skip three tests on FreeBSD 13
Some tests that use signals frequently fail randomly on FreeBSD 13.
Maybe something around signals has changed in FreeBSD 13.
This change skips them tentatively.
2022-03-08 16:06:37 +09:00
Hiroshi SHIBATA dcb02cb28a [ruby/io-nonblock] Use omit instead of skip for test-unit
https://github.com/ruby/io-nonblock/commit/a7bfbfa049
2022-01-12 11:02:24 +09:00
Hiroshi SHIBATA bf2bd6dc22 [ruby/io-wait] Use omit instead of skip for test-unit
https://github.com/ruby/io-wait/commit/75543ab1bc
2022-01-12 10:53:57 +09:00
Kazuhiro NISHIYAMA d5836db1b3 Fix Leaked file descriptor: TestIO_Console#test_console_kw
```
Leaked file descriptor: TestIO_Console#test_console_kw: 10 : #<File:/dev/tty>
```
2022-01-05 09:05:52 +09:00
Samuel Williams f27eb8148f Sync io-console gem. 2021-12-29 13:27:40 +13:00
Nobuyoshi Nakada dc5512243b [ruby/io-wait] Disable ractor test which is meaningless on earlier versions
https://github.com/ruby/io-wait/commit/e8e1e99d4c
2021-11-16 20:25:44 +09:00
Nobuyoshi Nakada d305ae5f04 [ruby/io-wait] Use omit as per test-unit
https://github.com/ruby/io-wait/commit/1f59f7b02f
2021-11-16 20:25:41 +09:00
Koichi Sasada 38c555a315 show encoding for each path 2021-11-14 02:41:30 +09:00
Yusuke Endoh 4d8d8c9d49 test/io/console/test_io_console.rb: dump debug output to stderr
make test-all in parallel mode seems to hide stdout
2021-11-14 02:35:03 +09:00
Yusuke Endoh 3aa62b455c test/io/console/test_io_console.rb: add debug code
to debug the following failure

http://ci.rvm.jp/results/trunk-test@ruby-sky1/3708240
```
/tmp/ruby/v3/src/trunk-test/test/io/console/test_io_console.rb:10:in `===': incompatible encoding regexp match (US-ASCII regexp with UTF-16BE string) (Encoding::CompatibilityError)
	/tmp/ruby/v3/src/trunk-test/test/io/console/test_io_console.rb:10:in `each'
	/tmp/ruby/v3/src/trunk-test/test/io/console/test_io_console.rb:10:in `grep'
	/tmp/ruby/v3/src/trunk-test/test/io/console/test_io_console.rb:10:in `<class:TestIO_Console>'
	/tmp/ruby/v3/src/trunk-test/test/io/console/test_io_console.rb:9:in `<top (required)>'
	<internal:/tmp/ruby/v3/src/trunk-test/lib/rubygems/core_ext/kernel_require.rb>:85:in `require'
	<internal:/tmp/ruby/v3/src/trunk-test/lib/rubygems/core_ext/kernel_require.rb>:85:in `require'
	/tmp/ruby/v3/src/trunk-test/tool/lib/test/unit/parallel.rb:122:in `run'
	/tmp/ruby/v3/src/trunk-test/tool/lib/test/unit/parallel.rb:211:in `<main>'
running file: /tmp/ruby/v3/src/trunk-test/test/io/console/test_io_console.rb
```
2021-11-12 16:23:00 +09:00
Nobuyoshi Nakada b9f7286fe9 [ruby/io-console] Skip Interrupt test on Solaris too
https://github.com/ruby/io-console/commit/48db3616da
2021-10-11 11:33:15 +09:00
Nobuyoshi Nakada f6d5de8f33 [ruby/io-wait] Declare as Ractor-safe
Fixes https://bugs.ruby-lang.org/issues/17659

https://github.com/ruby/io-wait/commit/ba338b4764
2021-03-07 09:54:35 +09:00