MCPcopy
hub / github.com/wavetermdev/waveterm / ConnServerInitCommand

Method ConnServerInitCommand

pkg/wshrpc/wshremote/wshremote.go:106–128  ·  view source on GitHub ↗
(ctx context.Context, data wshrpc.CommandConnServerInitData)

Source from the content-addressed store, hash-verified

104}
105
106func (impl *ServerImpl) ConnServerInitCommand(ctx context.Context, data wshrpc.CommandConnServerInitData) error {
107 if data.ClientId == "" {
108 return fmt.Errorf("clientid is required")
109 }
110 if impl.SockName == "" {
111 return fmt.Errorf("sockname not set in server impl")
112 }
113 symlinkPath, err := wavebase.ExpandHomeDir(wavebase.GetPersistentRemoteSockName(data.ClientId))
114 if err != nil {
115 return fmt.Errorf("cannot expand symlink path: %w", err)
116 }
117 symlinkDir := filepath.Dir(symlinkPath)
118
119 if err := os.MkdirAll(symlinkDir, 0700); err != nil {
120 return fmt.Errorf("could not create client directory %s: %w", symlinkDir, err)
121 }
122 os.Remove(symlinkPath)
123 if err := os.Symlink(impl.SockName, symlinkPath); err != nil {
124 return fmt.Errorf("could not create symlink %s -> %s: %w", symlinkPath, impl.SockName, err)
125 }
126 impl.Log("created symlink %s -> %s\n", symlinkPath, impl.SockName)
127 return nil
128}
129
130func (impl *ServerImpl) getWshPath() (string, error) {
131 if impl.IsLocal {

Callers

nothing calls this directly

Calls 3

LogMethod · 0.95
ExpandHomeDirFunction · 0.92

Tested by

no test coverage detected