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

Function makeCancellableCommand

pkg/wslconn/wsl-util.go:117–130  ·  view source on GitHub ↗
(ctx context.Context, client *wsl.Distro, cmdTemplateRaw string, words map[string]string)

Source from the content-addressed store, hash-verified

115}
116
117func makeCancellableCommand(ctx context.Context, client *wsl.Distro, cmdTemplateRaw string, words map[string]string) (*CancellableCmd, error) {
118 cmdContext, cmdCancel := context.WithCancel(ctx)
119
120 cmdStr := &bytes.Buffer{}
121 cmdTemplate, err := template.New("").Parse(cmdTemplateRaw)
122 if err != nil {
123 cmdCancel()
124 return nil, err
125 }
126 cmdTemplate.Execute(cmdStr, words)
127
128 cmd := client.WslCommand(cmdContext, cmdStr.String())
129 return &CancellableCmd{cmd, cmdCancel}, nil
130}
131
132func CpWshToRemote(ctx context.Context, client *wsl.Distro, clientOs string, clientArch string) error {
133 wshLocalPath, err := shellutil.GetLocalWshBinaryPath(wavebase.WaveVersion, clientOs, clientArch)

Callers 1

CpWshToRemoteFunction · 0.85

Calls 3

ParseMethod · 0.80
WslCommandMethod · 0.45
StringMethod · 0.45

Tested by

no test coverage detected