fix: clean stale pid on remove, use shlex.split for ssh_options

This commit is contained in:
2026-05-21 13:13:25 +08:00
parent 1792eab55d
commit f218f3ebc2
2 changed files with 3 additions and 1 deletions

View File

@@ -110,6 +110,7 @@ def remove(ctx, name):
raise click.ClickException(f"Stop '{name}' before removing it") raise click.ClickException(f"Stop '{name}' before removing it")
if not click.confirm(f"Remove tunnel '{name}'?"): if not click.confirm(f"Remove tunnel '{name}'?"):
return return
delete_pid_file(config_dir, name)
save_tunnels(config_dir, [t for t in tunnels if t.name != name]) save_tunnels(config_dir, [t for t in tunnels if t.name != name])
click.echo(f"Removed tunnel '{name}'") click.echo(f"Removed tunnel '{name}'")

View File

@@ -1,4 +1,5 @@
import os import os
import shlex
import shutil import shutil
import signal import signal
import socket import socket
@@ -109,7 +110,7 @@ def build_autossh_cmd(tunnel: TunnelConfig) -> list[str]:
f"{tunnel.user}@{tunnel.host}", f"{tunnel.user}@{tunnel.host}",
] ]
if tunnel.ssh_options: if tunnel.ssh_options:
for opt in tunnel.ssh_options.split(): for opt in shlex.split(tunnel.ssh_options):
cmd.append(opt) cmd.append(opt)
return cmd return cmd