Fuzion Logo
fuzion-lang.dev — The Fuzion Language Portal
JavaScript seems to be disabled. Functionality is limited.

process/env_vars.fz


# This file is part of the Fuzion language implementation.
#
# The Fuzion language implementation is free software: you can redistribute it
# and/or modify it under the terms of the GNU General Public License as published
# by the Free Software Foundation, version 3 of the License.
#
# The Fuzion language implementation is distributed in the hope that it will be
# useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public
# License for more details.
#
# You should have received a copy of the GNU General Public License along with The
# Fuzion language implementation.  If not, see <https://www.gnu.org/licenses/>.


# -----------------------------------------------------------------------
#
#  Tokiwa Software GmbH, Germany
#
#  Source code of Fuzion standard library feature process.env_vars
#
# -----------------------------------------------------------------------


# the environment variables in this map are used
# when spawning a new process.
#
public env_vars(get container.Map String String) : simple_effect
pre
  get.keys ∀ (x -> x.as_codepoints ∀ (y -> y.is_ascii))
  get.values ∀ (x -> x.as_codepoints ∀ (y -> y.is_ascii))
is


# get env_vars that should be used when spawning
# a new process.
#
# if env_vars effect is installed. the environment variables
# are taken from the installed effect. otherwise an empty
# map is returned.
#
public env_vars container.Map String String =>
  if effect.type.is_installed env_vars
    env_vars.env.get
  else
    (container.hash_map String String).type.empty