Skip to content

Commit 3f8298e

Browse files
authored
Merge pull request #4939 from John-Colvin/patch-19
use WindowsException for errors from windows api
2 parents d3ec75f + 73242a3 commit 3f8298e

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

std/process.d

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3183,7 +3183,7 @@ private:
31833183
// some other windows error. Might actually be NO_ERROR, because
31843184
// GetEnvironmentVariable doesn't specify whether it sets on all
31853185
// failures
3186-
throw new Exception(sysErrorString(err));
3186+
throw new WindowsException(err);
31873187
}
31883188
if (len == 1)
31893189
{
@@ -3208,7 +3208,7 @@ private:
32083208
if (err == ERROR_ENVVAR_NOT_FOUND) // variable didn't exist
32093209
return false;
32103210
// some other windows error
3211-
throw new Exception(sysErrorString(err));
3211+
throw new WindowsException(err);
32123212
}
32133213
assert (lenRead != buf.length, "impossible according to msft docs");
32143214
if (lenRead < buf.length) // the buffer was long enough
@@ -3277,6 +3277,9 @@ private:
32773277
assert (res !is null);
32783278
assert (res == "");
32793279

3280+
// Important to do the following round-trip after the previous test
3281+
// because it tests toAA with an empty var
3282+
32803283
// Convert to associative array
32813284
auto aa = environment.toAA();
32823285
assert (aa.length > 0);

0 commit comments

Comments
 (0)