1
1
mirror of https://github.com/wez/wezterm.git synced 2024-11-25 21:07:39 +03:00

wezterm: workaround appimage startup issue

AppImage passes fd 1023 opened on the mount point directory.
If we close this prior to exec, some magic in appimage decides
to unmount the fuse mount right before we're about to exec
the wezterm-gui binary from the appimage.

So, don't close stray fds when the cli spawns the gui when
we're an appimage.

See also: e831032c72

closes: #419
This commit is contained in:
Wez Furlong 2021-01-09 08:20:12 -08:00
parent ce6ecc1f38
commit d2e31148a0

View File

@ -271,7 +271,13 @@ fn delegate_to_gui(saver: UmaskSaver) -> anyhow::Result<()> {
#[cfg(unix)] #[cfg(unix)]
{ {
use std::os::unix::process::CommandExt; use std::os::unix::process::CommandExt;
// Clean up random fds, except when we're running in an AppImage.
// AppImage relies on child processes keeping alive an fd that
// references the mount point and if we close it as part of execing
// the gui binary, the appimage gets unmounted before we can exec.
if std::env::var_os("APPIMAGE").is_none() {
portable_pty::unix::close_random_fds(); portable_pty::unix::close_random_fds();
}
return Err(anyhow::anyhow!("failed to exec: {:?}", cmd.exec())); return Err(anyhow::anyhow!("failed to exec: {:?}", cmd.exec()));
} }