Open gasinvein opened 4 years ago
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.
@smcv This sounds good enough to me.
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.