Skip to content

Commit 268bb34

Browse files
authored
Merge pull request #73496 from ktoso/pick-wip-fix-checkIsCurrentExecutorMode
2 parents fcf6e56 + f650dc0 commit 268bb34

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

stdlib/public/Concurrency/Actor.cpp

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -351,15 +351,16 @@ static void checkIsCurrentExecutorMode(void *context) {
351351

352352
// Potentially, override the platform detected mode, primarily used in tests.
353353
#if SWIFT_STDLIB_HAS_ENVIRON
354-
const char *modeStr = getenv("SWIFT_IS_CURRENT_EXECUTOR_LEGACY_MODE_OVERRIDE");
355-
if (!modeStr)
356-
return;
357-
358-
if (strcmp(modeStr, "nocrash") == 0) {
359-
useLegacyMode = Legacy_NoCheckIsolated_NonCrashing;
360-
} else if (strcmp(modeStr, "crash") == 0) {
361-
useLegacyMode = Default_UseCheckIsolated_AllowCrash;
362-
} // else, just use the platform detected mode
354+
if (const char *modeStr =
355+
getenv("SWIFT_IS_CURRENT_EXECUTOR_LEGACY_MODE_OVERRIDE")) {
356+
if (modeStr && *modeStr) {
357+
if (strcmp(modeStr, "nocrash") == 0) {
358+
useLegacyMode = true;
359+
} else if (strcmp(modeStr, "crash") == 0) {
360+
useLegacyMode = false;
361+
} // else, just use the platform detected mode
362+
}
363+
}
363364
#endif // SWIFT_STDLIB_HAS_ENVIRON
364365
isCurrentExecutorMode = useLegacyMode ? Legacy_NoCheckIsolated_NonCrashing
365366
: Default_UseCheckIsolated_AllowCrash;

0 commit comments

Comments
 (0)