Fixes 7283 (#7284)

This commit is contained in:
cooldome
2018-03-05 18:06:47 +00:00
committed by Andreas Rumpf
parent 86c3832201
commit 4790b6d63f
3 changed files with 14 additions and 1 deletions

View File

@@ -83,6 +83,8 @@ proc setupVM*(module: PSym; cache: IdentCache; scriptName: string;
setResult(a, os.getEnv(a.getString 0, a.getString 1))
cbconf existsEnv:
setResult(a, os.existsEnv(a.getString 0))
cbconf putEnv:
os.putEnv(a.getString 0, a.getString 1)
cbconf dirExists:
setResult(a, os.dirExists(a.getString 0))
cbconf fileExists:

View File

@@ -114,6 +114,10 @@ proc existsEnv*(key: string): bool {.tags: [ReadIOEffect].} =
## Checks for the existence of an environment variable named `key`.
builtin
proc putEnv*(key, val: string) {.tags: [WriteIOEffect].} =
## Sets the value of the environment variable named key to val.
builtin
proc fileExists*(filename: string): bool {.tags: [ReadIOEffect].} =
## Checks if the file exists.
builtin

View File

@@ -23,4 +23,11 @@ task default, "default target":
setCommand "c"
# bug #6327
discard existsEnv("dummy")
doAssert(existsEnv("dummy") == false)
# issue #7283
putEnv("dummy", "myval")
doAssert(existsEnv("dummy") == true)
doAssert(getEnv("dummy") == "myval")