From: Eric Wong Date: 2018-11-02T21:14:53+00:00 Subject: [ruby-core:89685] Re: [Ruby trunk Feature#15277] at_exec 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: