change commands to use flatpak-spawn --host

This commit is contained in:
2022-07-14 22:06:16 +02:00
parent 4adb9a9708
commit f622509b0f
2 changed files with 14 additions and 4 deletions

View File

@@ -147,7 +147,9 @@ impl ToolbxContainer {
} }
pub fn stop(&mut self) -> Result<(), ToolbxError> { pub fn stop(&mut self) -> Result<(), ToolbxError> {
let output = Command::new("podman") let output = Command::new("flatpak-spawn")
.arg("--host") //Command::new("podman")
.arg("podman")
.arg("stop") .arg("stop")
.arg(self.name.clone()) .arg(self.name.clone())
.output(); .output();
@@ -178,7 +180,9 @@ impl ToolbxContainer {
} }
pub fn start(&mut self) -> Result<(), ToolbxError> { pub fn start(&mut self) -> Result<(), ToolbxError> {
let output = Command::new("podman") let output = Command::new("flatpak-spawn")
.arg("--host") //Command::new("podman")
.arg("podman")
.arg("start") .arg("start")
.arg(self.name.clone()) .arg(self.name.clone())
.output(); .output();
@@ -258,12 +262,16 @@ fn test_start_non_existing_containter() {
} }
pub fn run_cmd_toolbx_list_containers() -> String { pub fn run_cmd_toolbx_list_containers() -> String {
let output = Command::new("toolbox") let output = Command::new("flatpak-spawn")
.arg("--host")
.arg("toolbox")
.arg("list") .arg("list")
.arg("--containers") .arg("--containers")
.output() .output()
.expect("Failed to execute command"); .expect("Failed to execute command");
println!("{:?}", String::from_utf8_lossy(&output.stdout).to_string());
String::from_utf8_lossy(&output.stdout).to_string() String::from_utf8_lossy(&output.stdout).to_string()
} }

View File

@@ -69,7 +69,9 @@ impl AppUpdate for AppModel {
AppMsg::OpenToolbxTerminal(index) => { AppMsg::OpenToolbxTerminal(index) => {
if let Some(toolbx_container) = self.toolboxes.get_mut(index.current_index()) { if let Some(toolbx_container) = self.toolboxes.get_mut(index.current_index()) {
// TODO: support many terminals and check which are installed // TODO: support many terminals and check which are installed
let output = Command::new("gnome-terminal") let output = Command::new("flatpak-spawn")
.arg("--host")
.arg("gnome-terminal") //Command::new("gnome-terminal")
.arg("--") .arg("--")
.arg("toolbox") .arg("toolbox")
.arg("enter") .arg("enter")