Documentation
¶
Overview ¶
Package flatpak detects a Flatpak sandbox and runs commands on the host from inside one. The sandbox cannot see the host's programs, processes or autostart folder, so a command reaches them through flatpak-spawn, which needs the org.freedesktop.Flatpak bus name (--talk-name=org.freedesktop.Flatpak) in the app's finish-args.
Index ¶
- func Command(ctx context.Context, name string, args ...string) *exec.Cmd
- func CommandContext(ctx context.Context, name string, args ...string) *exec.Cmd
- func HostArgv(dir string, env []string, name string, args ...string) (string, []string)
- func HostLookPath(ctx context.Context, name string) (string, error)
- func Inside() bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Command ¶
Command returns the Cmd that runs name on the host: flatpak-spawn --host inside a Flatpak, name itself outside. Inside, the Cmd is flatpak-spawn's, so Dir and Env set on it do not reach the host program; use HostArgv for those. It is built with CommandContext.
func CommandContext ¶
CommandContext is exec.CommandContext, except that for name "flatpak-spawn" a cancel sends SIGTERM and WaitDelay is 5 s. flatpak-spawn forwards SIGTERM to the host child but cannot forward the SIGKILL Go sends by default, which would leave the child running.
func HostArgv ¶
HostArgv returns the flatpak-spawn command line that runs name on the host, in dir when non-empty, with env added. Pure: callers that start the process themselves (with their own pipes, process group, context) use it.
func HostLookPath ¶
HostLookPath finds name on the host's PATH, or returns exec.ErrNotFound. It asks the host's sh rather than which, which minimal hosts do not install. It always spawns flatpak-spawn, so call it only inside a Flatpak.
Types ¶
This section is empty.