Skip to content

Commit

Permalink
feat: unsetEnv -> add function
Browse files Browse the repository at this point in the history
  • Loading branch information
srghma committed Oct 27, 2020
1 parent 88871d8 commit 2293e81
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/Node/Process.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ exports.setEnv = function (var_) {
};
};

exports.unsetEnv = function (var_) {
return function () {
delete process.env[var_];
};
};

exports.exit = function (code) {
return function () {
process.exit(code);
Expand Down
5 changes: 5 additions & 0 deletions src/Node/Process.purs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ module Node.Process
, getEnv
, lookupEnv
, setEnv
, unsetEnv
, pid
, platform
, exit
Expand Down Expand Up @@ -101,6 +102,10 @@ lookupEnv k = FO.lookup k <$> getEnv
-- | Set an environment variable.
foreign import setEnv :: String -> String -> Effect Unit

-- | Delete an environment variable.
-- | Use case: to hide secret environment variable from child processes.
foreign import unsetEnv :: String -> Effect Unit

pid :: Pid
pid = process.pid

Expand Down

0 comments on commit 2293e81

Please sign in to comment.