You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I recently added simplecov to my project, and found if i wanted simplecov to track what Parallel was doing I had to override the Parallel.worker method to inject SimpleCov.start and a unique command name.
I ended up adding this whole overridden method to my .simplecov file:
moduleParalleldefself.worker(job_factory,options, &block)child_read,parent_write=IO.pipeparent_read,child_write=IO.pipepid=Process.forkdoself.worker_number=options[:worker_number]begin# here begins my additionsSimpleCov.command_name"Parallel #{worker_number}#{Process.pid}"SimpleCov.start# here ends my additionsoptions.delete(:started_workers).each(&:close_pipes)parent_write.closeparent_read.closeprocess_incoming_jobs(child_read,child_write,job_factory,options, &block)ensurechild_read.closechild_write.closeendendchild_read.closechild_write.closeWorker.new(parent_read,parent_write,pid)endend
I'd love a way to do this that was expected. (and I'd prefer that way be global rather than every Parrallel.each call.)
Do you have a preference/expectation for how one should do this? I'm happy to make a PR adding an option if you'd like
Perhaps someone could have in their .simplecov something like
and we add Parallel.post_fork&.call in the Process.worker method where i added my code?
Thanks :)
The text was updated successfully, but these errors were encountered:
robotdana
changed the title
Adding a hook for having just started a process?
Adding a hook for having just started a process? (making SimpleCov work)
Mar 2, 2020
I recently added simplecov to my project, and found if i wanted simplecov to track what Parallel was doing I had to override the
Parallel.worker
method to inject SimpleCov.start and a unique command name.I ended up adding this whole overridden method to my .simplecov file:
I'd love a way to do this that was expected. (and I'd prefer that way be global rather than every
Parrallel.each
call.)Do you have a preference/expectation for how one should do this? I'm happy to make a PR adding an option if you'd like
Perhaps someone could have in their .simplecov something like
and we add
Parallel.post_fork&.call
in the Process.worker method where i added my code?Thanks :)
The text was updated successfully, but these errors were encountered: