schmidt/structured_warnings — pull request #4 by mjtko (2013-05-22 22:29:22+00:00)
Title: Fix when fork used in non-main thread

If a process forks from a thread that is not Thread.main, the dynamic variables are not copied to the subprocess, resulting in breakage should anything in the subprocess call structured warnings code, such as use of the overridden Kernel#warn. This is due to the fact that Thread.main in a forked process is inherited from Thread.current in the forking process, and no other threads are copied.

This PR includes a failing test and a fix that uses a singleton class level instance variable to provide the 'main' dynamics Hash rather than relying on Thread.main remaining the same object within forked subprocesses.