tracing: fix static destruction order issue
Sometimes, the parallel/test-tracing-no-crash
would not work as
expected, at least on Windows, because there is a static destruction
race between tearing down the NodeTraceWriter
instance and the
per-process options struct. If the per-process options were destroyed
before the NodeTraceWriter
, the reference to the tracing filename
would be gone before opening the file was attempted.
This can be solved by creating a copy of the string when creating the
NodeTraceWriter
instance rather than taking a reference.
Fixes: https://github.com/nodejs/node/issues/22523
Checklist
-
make -j4 test
(UNIX), orvcbuild test
(Windows) passes (presumably) -
tests and/or benchmarks are included -
commit message follows commit guidelines