Skip to content
This repository has been archived by the owner on Sep 23, 2021. It is now read-only.

Linux: option.env not used #138

Open
gautejohan opened this issue Jan 28, 2021 · 0 comments
Open

Linux: option.env not used #138

gautejohan opened this issue Jan 28, 2021 · 0 comments

Comments

@gautejohan
Copy link

Firstly, thank you for a great library!

We are starting a cli tool from an electron app with sudo-prompt. To pass on environment variables we tried using the options.env property.

For what i can understand this wont work on Linux. pkexec is removing all environment variables before running command, so to get around this we added the environment variables at the beginning of our call, something like this:

This works:

sudo.exec('ENV_VAR1="1" ENV_VAR2="2" cli-commando', { name: 'Some name' },
    (error, stdout) => {
      ....
    });

This does not work:

sudo.exec('cli-commando', { name: 'Some name', env: { ENV_VAR1: '1', ENV_VAR2: '2' } },
    (error, stdout) => {
      ....
    });

Is there anything I'm doing wrong or have misunderstood?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant