ruby-core / marc-andre.ca wrote:
> https://bugs.ruby-lang.org/issues/15277

Would this work for subprocesses? (system, spawn, ``, popen, ...)
(if so, it would defeat vfork optimization we do under Linux)

> There's currently no easy way to have code executed before a subsequent call
> to `exec`. One has to monkey-patch the builtin method.
> 
> Use case: we roll our own in `DeepCover`. Some test suites will call `exec`,
> and we need to store our counters before that happens.

As described above, Ruby already has a mechanism for hooking
existing method calls.  I tend to avoid monkey patching because
it leads to surprising behavior.  However, `at_exec` would have
the SAME surprises as monkey-patching.

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