-
Notifications
You must be signed in to change notification settings - Fork 5
Expand file tree
/
Copy pathputty.go
More file actions
37 lines (29 loc) · 691 Bytes
/
putty.go
File metadata and controls
37 lines (29 loc) · 691 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
package main
import (
"fmt"
"os/exec"
)
func exec_putty(params CloudShellEnv) {
key, err := env_get_ssh_ppk()
if err != nil {
fmt.Println("\nTip: Run the command: \"gcloud alpha cloud-shell ssh --dry-run\" to setup Cloud Shell SSH keys")
return
}
sshUsername := params.SshUsername
sshHost := params.SshHost
sshPort := fmt.Sprint(params.SshPort)
sshUrl := sshUsername + "@" + sshHost
if config.Debug == true {
fmt.Println(key)
fmt.Println(sshUsername)
fmt.Println(sshHost)
fmt.Println(sshPort)
fmt.Println(sshUrl)
}
cmd := exec.Command("putty.exe", "-t", "-P", sshPort, "-i", key, sshUrl)
err = cmd.Start()
if err != nil {
fmt.Println(err)
return
}
}