aboutsummaryrefslogtreecommitdiffstats
path: root/src/c_exec.go
diff options
context:
space:
mode:
authorJoe <rbo@gmx.us>2024-05-02 20:20:20 +0200
committerJoe <rbo@gmx.us>2024-05-02 20:20:20 +0200
commit2f20bfedc4394301af9613e44bfe305b701ee12f (patch)
treeeab2bc5da8de0555173d99f097d469af2bda4984 /src/c_exec.go
parentquick weird bugfix (diff)
downloadhardflip-2f20bfedc4394301af9613e44bfe305b701ee12f.tar.gz
hardflip-2f20bfedc4394301af9613e44bfe305b701ee12f.tar.bz2
hardflip-2f20bfedc4394301af9613e44bfe305b701ee12f.tar.xz
hardflip-2f20bfedc4394301af9613e44bfe305b701ee12f.tar.zst
hardflip-2f20bfedc4394301af9613e44bfe305b701ee12f.zip
sshcmd
Diffstat (limited to 'src/c_exec.go')
-rw-r--r--src/c_exec.go34
1 files changed, 20 insertions, 14 deletions
diff --git a/src/c_exec.go b/src/c_exec.go
index a1547d4..6829d94 100644
--- a/src/c_exec.go
+++ b/src/c_exec.go
@@ -82,20 +82,20 @@ func c_exec_cmd(cmd_fmt, cmd_env []string, silent bool) (error, string) {
}
func c_format_ssh_jump(host *HostNode) string {
- jump_fmt := "-oProxyCommand=ssh"
- if len(host.Jump.Priv) > 0 {
- jump_fmt += " -i " + host.Jump.Priv
- }
- if host.Jump.Port != 0 {
- jump_fmt += " -p " + strconv.Itoa(int(host.Jump.Port))
- }
- if len(host.Jump.User) == 0 {
- jump_fmt += " root"
- } else {
- jump_fmt += " " + host.Jump.User
- }
- jump_fmt += "@" + host.Jump.Host + " -W %h:%p"
- return jump_fmt
+ jump_fmt := "-oProxyCommand=ssh"
+ if len(host.Jump.Priv) > 0 {
+ jump_fmt += " -i " + host.Jump.Priv
+ }
+ if host.Jump.Port != 0 {
+ jump_fmt += " -p " + strconv.Itoa(int(host.Jump.Port))
+ }
+ if len(host.Jump.User) == 0 {
+ jump_fmt += " root"
+ } else {
+ jump_fmt += " " + host.Jump.User
+ }
+ jump_fmt += "@" + host.Jump.Host + " -W %h:%p"
+ return jump_fmt
}
func c_format_ssh(host *HostNode, pass string) ([]string, []string) {
@@ -114,7 +114,13 @@ func c_format_ssh(host *HostNode, pass string) ([]string, []string) {
if host.Port != 0 {
cmd_fmt = append(cmd_fmt, "-p", strconv.Itoa(int(host.Port)))
}
+ if len(host.Exec) > 0 {
+ cmd_fmt = append(cmd_fmt, "-t")
+ }
cmd_fmt = append(cmd_fmt, host.User + "@" + host.Host)
+ if len(host.Exec) > 0 {
+ cmd_fmt = append(cmd_fmt, "--", host.Exec)
+ }
return cmd_fmt, nil
}