From 9565dc148e3c304fd0c01ae0ebb401040959b5cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1niel=20Buga?= Date: Sun, 11 Sep 2022 20:16:46 +0200 Subject: [PATCH] Only run command if file exists --- lapce-proxy/src/terminal.rs | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/lapce-proxy/src/terminal.rs b/lapce-proxy/src/terminal.rs index 64838c98..c5dfbe79 100644 --- a/lapce-proxy/src/terminal.rs +++ b/lapce-proxy/src/terminal.rs @@ -380,6 +380,12 @@ fn flatpak_should_use_host_terminal() -> bool { const FLATPAK_INFO_PATH: &str = "/.flatpak-info"; + // The de-facto way of checking whether one is inside of a Flatpak container is by checking for + // the presence of /.flatpak-info in the filesystem + if !Path::new(FLATPAK_INFO_PATH).exists() { + return false; + } + // Ensure flatpak-spawn --host can execute a basic command let host_available = Command::new("flatpak-spawn") .arg("--host") @@ -387,7 +393,5 @@ fn flatpak_should_use_host_terminal() -> bool { .status() .unwrap(); - // The de-facto way of checking whether one is inside of a Flatpak container is by checking for - // the presence of /.flatpak-info in the filesystem - Path::new(FLATPAK_INFO_PATH).exists() && host_available.success() + host_available.success() }