From 42c326b142ad0cad3fa3ff9bb8056fdbde13c77b Mon Sep 17 00:00:00 2001 From: Joseph Hunkeler Date: Wed, 22 May 2019 12:39:03 -0400 Subject: portability --- source/conda.d | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) (limited to 'source/conda.d') diff --git a/source/conda.d b/source/conda.d index 3f1fe1c..e2e1782 100644 --- a/source/conda.d +++ b/source/conda.d @@ -12,11 +12,18 @@ import std.typecons; static auto getenv(string[string] base=null, string preface=null) { const char delim = '='; + char delim_line = '\n'; string[string] env; string cmd = "env"; - version (Linux) { - cmd = cmd ~ " -0"; + version (linux) { + cmd ~= " -0"; + delim_line = '\0'; + } + + version (Windows) { + cmd = "set"; + delim_line = "\r\n"; } // Execute a command before dumping the environment @@ -31,7 +38,7 @@ static auto getenv(string[string] base=null, string preface=null) { throw new Exception("Unable to read shell environment"); } - foreach (string line; split(env_sh.output, '\0')) { + foreach (string line; split(env_sh.output, delim_line)) { if (line.empty) { continue; } -- cgit