-
Notifications
You must be signed in to change notification settings - Fork 3
Expand file tree
/
Copy pathmanager_windows.go
More file actions
79 lines (63 loc) · 1.95 KB
/
Copy pathmanager_windows.go
File metadata and controls
79 lines (63 loc) · 1.95 KB
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
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
//go:build windows
package terminal
import (
"context"
"fmt"
"os"
"sync"
logging "github.com/omniviewdev/plugin-sdk/log"
sdkexec "github.com/omniviewdev/plugin-sdk/pkg/v1/exec"
"github.com/omniviewdev/plugin-sdk/pkg/types"
)
var errUnsupported = fmt.Errorf("terminal sessions are not supported on Windows")
// Manager manages terminal sessions. On Windows, PTY-based sessions are not
// supported, so all operations return errors.
type Manager struct {
log logging.Logger
sessions map[string]*sdkexec.Session
ptys map[string]*os.File
inMux chan sdkexec.StreamInput
outMux chan sdkexec.StreamOutput
resizeMux chan sdkexec.StreamResize
mux sync.RWMutex
}
func NewManager(
_ context.Context,
log logging.Logger,
) (*Manager, chan sdkexec.StreamInput, chan sdkexec.StreamOutput, chan sdkexec.StreamResize) {
inMux := make(chan sdkexec.StreamInput)
outMux := make(chan sdkexec.StreamOutput)
resizeMux := make(chan sdkexec.StreamResize)
return &Manager{
log: log,
sessions: make(map[string]*sdkexec.Session),
ptys: make(map[string]*os.File),
inMux: inMux,
outMux: outMux,
resizeMux: resizeMux,
}, inMux, outMux, resizeMux
}
func (m *Manager) GetSession(_ string) (*sdkexec.Session, error) {
return nil, errUnsupported
}
func (m *Manager) ListSessions(_ *types.PluginContext) []*sdkexec.Session {
return nil
}
func (m *Manager) StartSession(_ *types.PluginContext, _ sdkexec.SessionOptions) (*sdkexec.Session, error) {
return nil, errUnsupported
}
func (m *Manager) ResizeSession(_ string, _, _ uint16) error {
return errUnsupported
}
func (m *Manager) WriteSession(_ string, _ []byte) error {
return errUnsupported
}
func (m *Manager) AttachSession(_ string) (*sdkexec.Session, []byte, error) {
return nil, nil, errUnsupported
}
func (m *Manager) DetachSession(_ string) (*sdkexec.Session, error) {
return nil, errUnsupported
}
func (m *Manager) CloseSession(_ string) error {
return errUnsupported
}