From 82fa7df53ce24fb8231cba570ce0943d83db3a7c Mon Sep 17 00:00:00 2001 From: Elias Batek Date: Thu, 9 Jan 2025 02:34:52 +0100 Subject: [PATCH 1/2] Replace internal `getEnvironPtr` with its equivalent from druntime --- std/process.d | 19 ++----------------- 1 file changed, 2 insertions(+), 17 deletions(-) diff --git a/std/process.d b/std/process.d index 1cb2264f6d3..b3fce1890c1 100644 --- a/std/process.d +++ b/std/process.d @@ -146,23 +146,8 @@ private // POSIX API declarations. version (Posix) { - version (Darwin) - { - extern(C) char*** _NSGetEnviron() nothrow; - const(char**) getEnvironPtr() @trusted - { - return *_NSGetEnviron; - } - } - else - { - // Made available by the C runtime: - extern(C) extern __gshared const char** environ; - const(char**) getEnvironPtr() @trusted - { - return environ; - } - } + static import core.sys.posix.unistd; + private alias getEnvironPtr = core.sys.posix.unistd.environ; @system unittest { From 15195761ce6be9468efec15f9733a69f8bbe19d0 Mon Sep 17 00:00:00 2001 From: Elias Batek Date: Thu, 9 Jan 2025 03:03:57 +0100 Subject: [PATCH 2/2] Further simplify --- std/process.d | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/std/process.d b/std/process.d index b3fce1890c1..7faf8498343 100644 --- a/std/process.d +++ b/std/process.d @@ -146,8 +146,7 @@ private // POSIX API declarations. version (Posix) { - static import core.sys.posix.unistd; - private alias getEnvironPtr = core.sys.posix.unistd.environ; + import core.sys.posix.unistd : getEnvironPtr = environ; @system unittest {