Issue #595 has been updated by ioquatix (Samuel Williams).

Target version set to next minor

After discussion, we decided that:

- Doing this in the GC is probably a bad idea.
- Ruby's general model for resource management is explicit, e.g. `f = File.open; f.close` or `File.open do |f| ... end`. The same model should applyto Fiber.
- We can implement something like `Fiber.kill` or `Fiber.close` which essentially invokes `Fiber.raise(Exception)` until the Fiber is dead.

We will test these ideas during 2.7 release. If there are any further thoughts about this approach, please feel free to add them here.

----------------------------------------
Bug #595: Fiber ignores ensure clause
https://bugs.ruby-lang.org/issues/595#change-75793

* Author: ko1 (Koichi Sasada)
* Status: Assigned
* Priority: Normal
* Assignee: ioquatix (Samuel Williams)
* Target version: next minor
* ruby -v: -
* Backport: 
----------------------------------------

 Ruby プロセス終了時,Fiber が ensure を無視します.
 これは,前から直そうと思って手がついていなかった問題です.
 10月末までには直そうと思います.結構複雑なので,後回しにしていましました.

``` 
 fib = Fiber.new{
   begin
     Fiber.yield :ok
   ensure
     puts "should be print out"
   end
 }
 p fib.resume
```


---Files--------------------------------
ensure_fiber.patch (2.12 KB)
ensure_fiber2.patch (7.57 KB)


-- 
https://bugs.ruby-lang.org/