| 424 | } |
| 425 | |
| 426 | func (p *PTY) WriteLine(str string) { |
| 427 | p.t.Helper() |
| 428 | |
| 429 | newline := []byte{'\r'} |
| 430 | if runtime.GOOS == "windows" { |
| 431 | newline = append(newline, '\n') |
| 432 | } |
| 433 | p.logf("stdin: %q", str+string(newline)) |
| 434 | _, err := p.Input().Write(append([]byte(str), newline...)) |
| 435 | require.NoError(p.t, err, "write line failed") |
| 436 | } |
| 437 | |
| 438 | // Named sets the PTY name in the logs. Defaults to "cmd". Make sure you set this before anything starts writing to the |
| 439 | // pty, or it may not be named consistently. E.g. |