Replace calls to putenv with setenv (#18530)
* Replace calls to C `putenv` with C `setenv` to remove possible memory leaks * Add test of correct behaviour on invalid input * Fix style in tests/stdlib/tos.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * Update tests/stdlib/tos.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * Update tests/stdlib/tos.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * Add comment with bug number to tests/stdlib/tos.nim Co-authored-by: Timothee Cour <timothee.cour2@gmail.com> * Fix possible msvc arch issues Co-authored-by: Timothee Cour <timothee.cour2@gmail.com>
This commit is contained in:
parent
5386ae75ba
commit
f62f4159f8
2 changed files with 11 additions and 3 deletions
|
|
@ -614,6 +614,9 @@ block osenv:
|
|||
doAssert existsEnv(dummyEnvVar) == false
|
||||
delEnv(dummyEnvVar) # deleting an already deleted env var
|
||||
doAssert existsEnv(dummyEnvVar) == false
|
||||
block: # putEnv, bug #18502
|
||||
doAssertRaises(OSError): putEnv("DUMMY_ENV_VAR_PUT=DUMMY_VALUE", "NEW_DUMMY_VALUE")
|
||||
doAssertRaises(OSError): putEnv("", "NEW_DUMMY_VALUE")
|
||||
block:
|
||||
doAssert getEnv("DUMMY_ENV_VAR_NONEXISTENT", "") == ""
|
||||
doAssert getEnv("DUMMY_ENV_VAR_NONEXISTENT", " ") == " "
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue