From f218f3ebc2a0c3d24cc29d7f0c59c1e242a2e355 Mon Sep 17 00:00:00 2001 From: tech Date: Thu, 21 May 2026 13:13:25 +0800 Subject: [PATCH] fix: clean stale pid on remove, use shlex.split for ssh_options --- src/autossh_mgr/cli.py | 1 + src/autossh_mgr/process.py | 3 ++- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/autossh_mgr/cli.py b/src/autossh_mgr/cli.py index 20b9d49..739e89b 100644 --- a/src/autossh_mgr/cli.py +++ b/src/autossh_mgr/cli.py @@ -110,6 +110,7 @@ def remove(ctx, name): raise click.ClickException(f"Stop '{name}' before removing it") if not click.confirm(f"Remove tunnel '{name}'?"): return + delete_pid_file(config_dir, name) save_tunnels(config_dir, [t for t in tunnels if t.name != name]) click.echo(f"Removed tunnel '{name}'") diff --git a/src/autossh_mgr/process.py b/src/autossh_mgr/process.py index f66f42e..6b351d1 100644 --- a/src/autossh_mgr/process.py +++ b/src/autossh_mgr/process.py @@ -1,4 +1,5 @@ import os +import shlex import shutil import signal import socket @@ -109,7 +110,7 @@ def build_autossh_cmd(tunnel: TunnelConfig) -> list[str]: f"{tunnel.user}@{tunnel.host}", ] if tunnel.ssh_options: - for opt in tunnel.ssh_options.split(): + for opt in shlex.split(tunnel.ssh_options): cmd.append(opt) return cmd