| Index: runtime/vm/os_macos.cc
|
| diff --git a/runtime/vm/os_macos.cc b/runtime/vm/os_macos.cc
|
| index d4ff67912c6b0b7b1697b730a9d6f83e3cdfdc6a..9e9241c67746bde19227db25e31fb843702c3d2e 100644
|
| --- a/runtime/vm/os_macos.cc
|
| +++ b/runtime/vm/os_macos.cc
|
| @@ -423,6 +423,21 @@ void OS::InitOnce() {
|
| static bool init_once_called = false;
|
| ASSERT(init_once_called == false);
|
| init_once_called = true;
|
| +
|
| + // See https://github.com/dart-lang/sdk/issues/29539
|
| + // This is a workaround for a macos bug, we eagerly call localtime_r so that
|
| + // libnotify is initialized early before any fork happens.
|
| + struct timeval tv;
|
| + if (gettimeofday(&tv, NULL) < 0) {
|
| + FATAL1("gettimeofday returned an error (%s)\n", strerror(errno));
|
| + return;
|
| + }
|
| + tm decomposed;
|
| + struct tm* error_code = localtime_r(&(tv.tv_sec), &decomposed);
|
| + if (error_code == NULL) {
|
| + FATAL1("localtime_r returned an error (%s)\n", strerror(errno));
|
| + return;
|
| + }
|
| }
|
|
|
|
|
|
|