From 78414b5ae1838f2427d2b1154f60f6e19473260c Mon Sep 17 00:00:00 2001 From: Joe Wilm Date: Tue, 24 May 2016 20:55:51 -0700 Subject: Implement tty::new() Opens a pty, forks a child process, and execs the shell defined in user's /etc/passwd file. Bytes from the pty are currently just written to Alacritty's stdout as a sanity check that things are hooked up. Thanks to `st` for some guidance on setting this up. --- src/main.rs | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) (limited to 'src/main.rs') diff --git a/src/main.rs b/src/main.rs index 3b1d7335..e95908d3 100644 --- a/src/main.rs +++ b/src/main.rs @@ -1,3 +1,6 @@ +//! Alacritty - The GPU Enhanced Terminal +#![feature(question_mark)] + extern crate fontconfig; extern crate freetype; extern crate libc; @@ -7,11 +10,14 @@ extern crate euclid; use std::collections::HashMap; +use std::io::{BufReader, Read, BufRead}; + mod list_fonts; mod text; mod renderer; mod grid; mod meter; +mod tty; use renderer::{Glyph, QuadRenderer}; use text::FontDesc; @@ -76,6 +82,14 @@ fn main() { let num_cols = grid::num_cells_axis(cell_width, sep_x, width); let num_rows = grid::num_cells_axis(cell_height, sep_y, height); + let mut cmd = tty::new(num_rows as u8, num_cols as u8); + + ::std::thread::spawn(move || { + for byte in cmd.bytes() { + println!("{:?}", byte); + } + }); + println!("num_cols, num_rows = {}, {}", num_cols, num_rows); let mut grid = Grid::new(num_rows as usize, num_cols as usize); @@ -130,7 +144,7 @@ fn main() { for event in window.poll_events() { match event { glutin::Event::Closed => break 'main_loop, - _ => println!("event: {:?}", event) + _ => () } } -- cgit