(ctx context.Context, data wshrpc.CommandJobInputData)
| 1507 | } |
| 1508 | |
| 1509 | func 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 | |
| 1541 | func resetTerminalState(logCtx context.Context, blockId string) { |
| 1542 | if blockId == "" { |
no test coverage detected