MCPcopy Index your code
hub / github.com/wavetermdev/waveterm / jobDebugGetOutputRun

Function jobDebugGetOutputRun

cmd/wsh/cmd/wshcmd-jobdebug.go:348–381  ·  view source on GitHub ↗
(cmd *cobra.Command, args []string)

Source from the content-addressed store, hash-verified

346}
347
348func jobDebugGetOutputRun(cmd *cobra.Command, args []string) error {
349 broker := RpcClient.StreamBroker
350 if broker == nil {
351 return fmt.Errorf("stream broker not available")
352 }
353
354 readerRouteId, err := wshclient.ControlGetRouteIdCommand(RpcClient, &wshrpc.RpcOpts{Route: wshutil.ControlRoute})
355 if err != nil {
356 return fmt.Errorf("getting route id: %w", err)
357 }
358 if readerRouteId == "" {
359 return fmt.Errorf("no route to receive data")
360 }
361 writerRouteId := "" // main server route
362 reader, streamMeta := broker.CreateStreamReader(readerRouteId, writerRouteId, 64*1024)
363 defer reader.Close()
364
365 data := wshrpc.CommandWaveFileReadStreamData{
366 ZoneId: jobIdFlag,
367 Name: "term",
368 StreamMeta: *streamMeta,
369 }
370
371 _, err = wshclient.WaveFileReadStreamCommand(RpcClient, data, nil)
372 if err != nil {
373 return fmt.Errorf("starting stream read: %w", err)
374 }
375
376 _, err = io.Copy(os.Stdout, reader)
377 if err != nil {
378 return fmt.Errorf("reading stream: %w", err)
379 }
380 return nil
381}
382
383func jobDebugStartRun(cmd *cobra.Command, args []string) error {
384 cmdToRun := args[0]

Callers

nothing calls this directly

Calls 5

ControlGetRouteIdCommandFunction · 0.92
CreateStreamReaderMethod · 0.80
CopyMethod · 0.80
CloseMethod · 0.65

Tested by

no test coverage detected