(mut pty: std::fs::File)
| 776 | } |
| 777 | |
| 778 | pub(super) fn pty_read(mut pty: std::fs::File) -> Receiver<String> { |
| 779 | let (tx, rx) = mpsc::channel::<String>(); |
| 780 | thread::spawn(move || { |
| 781 | loop { |
| 782 | thread::sleep(std::time::Duration::new(1, 0)); |
| 783 | let mut buf = [0; 512]; |
| 784 | match pty.read(&mut buf) { |
| 785 | Ok(_bytes) => { |
| 786 | let output = std::str::from_utf8(&buf).unwrap().to_string(); |
| 787 | match tx.send(output) { |
| 788 | Ok(_) => (), |
| 789 | Err(_) => break, |
| 790 | } |
| 791 | } |
| 792 | Err(_) => break, |
| 793 | } |
| 794 | } |
| 795 | }); |
| 796 | rx |
| 797 | } |
| 798 | |
| 799 | pub(crate) fn get_pty_path(api_socket: &str, pty_type: &str) -> PathBuf { |
| 800 | let (cmd_success, cmd_output, _) = remote_command_w_output(api_socket, "info", None); |
no test coverage detected