Files
fn_registry/functions/infra/ssh_tunnel_close.go
T
egutierrez 6d0d63cb23 feat: funciones SSH para infra — conn, check, exec, download, upload, tunnel
Conjunto completo de funciones SSH para operaciones remotas: conexión,
verificación de host, ejecución de comandos, transferencia de archivos
(upload/download) y gestión de túneles. Incluye tipo SSHConn y tests.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-02 22:03:41 +02:00

22 lines
440 B
Go

package infra
import (
"fmt"
"os"
"syscall"
)
// SSHTunnelClose cierra un tunel SSH enviando SIGTERM al proceso por PID.
func SSHTunnelClose(pid int) error {
proc, err := os.FindProcess(pid)
if err != nil {
return fmt.Errorf("ssh tunnel close: process %d not found: %w", pid, err)
}
err = proc.Signal(syscall.SIGTERM)
if err != nil {
return fmt.Errorf("ssh tunnel close: cannot signal PID %d: %w", pid, err)
}
return nil
}