-
Notifications
You must be signed in to change notification settings - Fork 937
/
Copy pathconsole_windows.go
46 lines (38 loc) · 987 Bytes
/
console_windows.go
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
38
39
40
41
42
43
44
45
46
//go:build windows
package main
import (
"fmt"
"os"
"os/exec"
"path/filepath"
"strings"
"github.com/gorilla/websocket"
)
func (c *cmdConsole) getTERM() (string, bool) {
return "dumb", true
}
func (c *cmdConsole) controlSocketHandler(control *websocket.Conn) {
// TODO: figure out what the equivalent of signal.SIGWINCH is on
// windows and use that; for now if you resize your terminal it just
// won't work quite correctly.
err := c.sendTermSize(control)
if err != nil {
fmt.Printf("error setting term size %s\n", err)
}
}
func (c *cmdConsole) findCommand(name string) string {
path, _ := exec.LookPath(name)
if path == "" {
// Let's see if it's not in the usual location.
programs, err := os.ReadDir("\\Program Files")
if err != nil {
return ""
}
for _, entry := range programs {
if strings.HasPrefix(entry.Name(), "VirtViewer") {
return filepath.Join("\\Program Files", entry.Name(), "bin", "remote-viewer.exe")
}
}
}
return path
}