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

Function SendInput

pkg/jobcontroller/jobcontroller.go:1509–1539  ·  view source on GitHub ↗
(ctx context.Context, data wshrpc.CommandJobInputData)

Source from the content-addressed store, hash-verified

1507}
1508
1509func SendInput(ctx context.Context, data wshrpc.CommandJobInputData) error {
1510 jobId := data.JobId
1511
1512 if data.TermSize != nil {
1513 err := wstore.DBUpdateFn(ctx, jobId, func(job *waveobj.Job) {
1514 job.CmdTermSize = *data.TermSize
1515 })
1516 if err != nil {
1517 log.Printf("[job:%s] warning: failed to update termsize in DB: %v", jobId, err)
1518 }
1519 }
1520
1521 _, err := CheckJobConnected(ctx, jobId)
1522 if err != nil {
1523 return err
1524 }
1525
1526 rpcOpts := &wshrpc.RpcOpts{
1527 Route: wshutil.MakeJobRouteId(jobId),
1528 Timeout: 5000,
1529 NoResponse: false,
1530 }
1531
1532 bareRpc := wshclient.GetBareRpcClient()
1533 err = wshclient.JobInputCommand(bareRpc, data, rpcOpts)
1534 if err != nil {
1535 return fmt.Errorf("failed to send input to job: %w", err)
1536 }
1537
1538 return nil
1539}
1540
1541func resetTerminalState(logCtx context.Context, blockId string) {
1542 if blockId == "" {

Callers 1

SendInputMethod · 0.92

Calls 5

DBUpdateFnFunction · 0.92
MakeJobRouteIdFunction · 0.92
GetBareRpcClientFunction · 0.92
JobInputCommandFunction · 0.92
CheckJobConnectedFunction · 0.85

Tested by

no test coverage detected