diff options
author | Joe Wilm <joe@jwilm.com> | 2016-05-24 20:55:51 -0700 |
---|---|---|
committer | Joe Wilm <joe@jwilm.com> | 2016-05-24 21:06:19 -0700 |
commit | 78414b5ae1838f2427d2b1154f60f6e19473260c (patch) | |
tree | 0fa74d14d05dfaf90ecf08284d91b19b5683f351 /src/main.rs | |
parent | 855ae756973990be35186d554562a75f692c06e7 (diff) | |
download | r-alacritty-78414b5ae1838f2427d2b1154f60f6e19473260c.tar.gz r-alacritty-78414b5ae1838f2427d2b1154f60f6e19473260c.tar.bz2 r-alacritty-78414b5ae1838f2427d2b1154f60f6e19473260c.zip |
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.
Diffstat (limited to 'src/main.rs')
-rw-r--r-- | src/main.rs | 16 |
1 files changed, 15 insertions, 1 deletions
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) + _ => () } } |