From: ruby-core@... Date: 2018-11-02T19:23:48+00:00 Subject: [ruby-core:89680] [Ruby trunk Feature#15277] at_exec 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: