Issue #15277 has been reported by marcandre (Marc-Andre Lafortune).

----------------------------------------
Feature #15277: at_exec
https://bugs.ruby-lang.org/issues/15277

* Author: marcandre (Marc-Andre Lafortune)
* Status: Open
* Priority: Normal
* Assignee: matz (Yukihiro Matsumoto)
* Target version: 
----------------------------------------
There's currently no easy way to have code executed before a subsequent call to `exec`. One has to monkey-patch the builtin method.

I'd like to propose a new method `at_exec` that would be very similar to `at_exit`, except that the callbacks are triggered before the current process is replaced by the external command.

```
# This would output "Hello", "Bye", and "Foo"
at_exec { puts "Bye!" }
puts "Hello"
exec "echo Foo"
```

Use case: we roll our own in `DeepCover`. Some test suites will call `exec`, and we need to store our counters before that happens.



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

Unsubscribe: <mailto:ruby-core-request / ruby-lang.org?subject=unsubscribe>
<http://lists.ruby-lang.org/cgi-bin/mailman/options/ruby-core>