From 979932486a6b9360f09b6b843f155138b555aa68 Mon Sep 17 00:00:00 2001 From: Salem Yaslem Date: Mon, 23 Sep 2024 15:36:36 +0300 Subject: [PATCH] fix(Terminal): fallback to shell (sh) if bash not exists --- main.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/main.py b/main.py index b69c4ac..e872dd1 100644 --- a/main.py +++ b/main.py @@ -33,14 +33,14 @@ class TerminalOpener(QThread): self.container_id = container_id def run(self): - docker_command = f"docker exec -it {self.container_id} /bin/bash" + docker_command = f"docker exec -it {self.container_id} sh -c '[ -x /bin/bash ] && exec /bin/bash || exec /bin/sh'" system = platform.system() try: if system == "Darwin": # macOS - subprocess.Popen(['open', '-a', 'Terminal', '--', 'bash', '-c', f"{docker_command}"]) + subprocess.Popen(['open', '-a', 'Terminal', '--', 'sh', '-c', f"{docker_command}"]) elif system == "Linux": - subprocess.Popen(['x-terminal-emulator', '-e', f"bash -c '{docker_command}'"]) + subprocess.Popen(['x-terminal-emulator', '-e', f'sh -c "{docker_command}"']) elif system == "Windows": subprocess.Popen(['start', 'cmd', '/k', docker_command], shell=True) else: