Skip to content

Impossible to set environment variables without clearing environment #82

Open
@9999years

Description

@9999years

With setEnvInherit, a process can be executed with the environment variables inherited from the parent:

ghci> runProcess_ $ proc "sh" ["-c", "env"]
SHELL=/opt/homebrew/bin/fish
ITERM_PROFILE=Default
COLORTERM=truecolor
XPC_FLAGS=0x0
TERM_PROGRAM_VERSION=3.4
...

setEnv can be used to set environment variables, but doing so prevents the subprocess from inheriting any environment variables from its parent:

ghci> runProcess_ $ setEnv [("a", "b")] $ proc "sh" ["-c", "env"]
sh: line 1: env: command not found
*** Exception: Received ExitFailure 127 when running
Raw command: sh -c env

I'd like to (e.g.) run a program with environment variables inherited but with some changes.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions