( client: TmuxAttachedClient, input: string, settleMs = 50, )
| 312 | } |
| 313 | |
| 314 | export async function sendAttachedClientInput( |
| 315 | client: TmuxAttachedClient, |
| 316 | input: string, |
| 317 | settleMs = 50, |
| 318 | ): Promise<void> { |
| 319 | if (client.process.stdin.destroyed) { |
| 320 | throw new Error('Attached tmux client stdin is closed') |
| 321 | } |
| 322 | |
| 323 | await new Promise<void>((resolve, reject) => { |
| 324 | client.process.stdin.write(input, error => { |
| 325 | if (error) { |
| 326 | reject(error) |
| 327 | return |
| 328 | } |
| 329 | resolve() |
| 330 | }) |
| 331 | }) |
| 332 | |
| 333 | if (settleMs > 0) { |
| 334 | await delay(settleMs) |
| 335 | } |
| 336 | } |
| 337 | |
| 338 | function parsePaneMetrics(output: string): Omit<TmuxTraceFrame, 'label' | 'pane'> { |
| 339 | const [cursorX, cursorY, historySize, paneWidth, paneHeight] = output |
no test coverage detected