flatpak / flatpak-xdg-utils

Simple portal-based commandline tools for use inside flatpak sandboxes
GNU Lesser General Public License v2.1
34 stars 14 forks source link

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

Open gasinvein opened 4 years ago

gasinvein commented 4 years ago

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 commented 3 years ago

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

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 commented 3 years ago

@smcv This sounds good enough to me.