Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

flatpak-spawn: Option to copy current env vars #28

Open
gasinvein opened this issue Dec 20, 2019 · 2 comments
Open

flatpak-spawn: Option to copy current env vars #28

gasinvein opened this issue Dec 20, 2019 · 2 comments

Comments

@gasinvein
Copy link
Member

gasinvein commented Dec 20, 2019

It would be nice to have some option like --copy-env to automatically set all current environment variables for spawned process. This way it would behave more like a child process, that inherits current environment.
App-launching apps like Steam or Lutris would benefit from it a lot, since it would allow to easily restrict permissions for child app or game.

@smcv
Copy link
Contributor

smcv commented Dec 9, 2020

Steam's pressure-vessel-launch (which is loosely based on flatpak-spawn) has:

  • --unset-env=FOO: equivalent to env -u FOO
  • --pass-env=FOO: equivalent to --env=FOO=foo if FOO is set to foo, or --unset-env=FOO if FOO is unset
  • --pass-env-matching='*FO*': equivalent to --pass-env for every variable that is set in the caller's environment whose name matches the glob *FO*

I could do a MR to add these to flatpak-spawn if there's interest?

Then @gasinvein could use --clear-env --pass-env-matching='*' to get an exact copy of the caller's environment.

--unset-env is nicer to implement with help from the server sides in Flatpak (the portal and the session helper), but it's possible to emulate it against the existing Flatpak servers by literally using env -u FOO -u BAR myprogram as the command to execute.

@gasinvein
Copy link
Member Author

@smcv This sounds good enough to me.

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

No branches or pull requests

2 participants