Skip to content

Commit

Permalink
Implement setting environment variables
Browse files Browse the repository at this point in the history
  • Loading branch information
mtolly committed Oct 21, 2014
1 parent 5e11d33 commit a924cea
Showing 1 changed file with 19 additions and 0 deletions.
19 changes: 19 additions & 0 deletions src/environment.js
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,25 @@ function h$getenv(name, name_off) {
return null;
}

function h$putenv(name, name_off) {
TRACE_ENV("putenv");
#ifndef GHCJS_BROWSER
if(h$isNode) {
var nv = h$decodeUtf8z(name, name_off).split('=', 2);
if(nv.length !== 2) return 0;
var n = nv[0];
var v = nv[1];
if (v !== '') {
process.env[n] = v;
}
else {
delete process.env[n];
}
}
#endif
return 0;
}

function h$errorBelch() {
h$log("### errorBelch: do we need to handle a vararg function here?");
}
Expand Down

0 comments on commit a924cea

Please sign in to comment.