* chore(config): default kdl keybindings config * tests * work * refactor(config): move stuff around * work * tab merge layout * work * work * layouts working * work * layout tests * work * work * feat(parsing): kdl layouts without config * refactor(kdl): move stuff around * work * tests(layout): add cases and fix bugs * work * fix(kdl): various bugs * chore(layouts): move all layouts to kdl * feat(kdl): shared keybidns * fix(layout): do not count fixed panes toward percentile * fix(keybinds): missing keybinds and actions * fix(config): adjust default tips * refactor(config): move stuff around * fix(tests): make e2e tests pass * fix(kdl): add verbose parsing errors * fix(kdl): focused tab * fix(layout): corret default_tab_template behavior * style(code): fix compile warnings * feat(cli): send actions through the cli * fix(cli): exit only when action is done * fix(cli): open embedded pane from floating pane * fix(cli): send actions to other sessions * feat(cli): command alias * feat(converter): convert old config * feat(converter): convert old layout and theme files * feat(kdl): pretty errors * feat(client): convert old YAML files on startup * fix: various bugs and styling issues * fix: e2e tests * fix(screen): propagate errors after merge * style(clippy): lower clippy level * fix(tests): own session_name variable * style(fmt): rustfmt * fix(cli): various action fixes * style(fmt): rustfmt * fix(themes): loading of theme files * style(fmt): rustfmt * fix(tests): theme fixtures * fix(layouts): better errors on unknown nodes * fix(kdl): clarify valid node terminator error * fix(e2e): adjust close tab test * fix(e2e): adjust close tab test again * style(code): cleanup some comments * get command panes not to exit on command exit * separate terminal pane_ids from raw_fds * render frame according to exit status * re-run command on enter and close pane on ctrl-c * proper error when command is not found * make ui nicer * initial pane title for command panes * fix pane override bug * reap terminal_ids from os_input_output on pane close * bool floating flag * some ui tweaks * fix tests * make rustfmt happy * e2e test for command pane * fix various concurrency issues * rename command to run in the cli * rustfmt * style(fmt): rustfmt * fix(e2e): command => run * fix(e2e): command => run in snapshot too!
50 lines
1.2 KiB
Rust
50 lines
1.2 KiB
Rust
use super::*;
|
|
|
|
use nix::{pty::openpty, unistd::close};
|
|
|
|
struct TestTerminal {
|
|
openpty: OpenptyResult,
|
|
}
|
|
|
|
impl TestTerminal {
|
|
pub fn new() -> TestTerminal {
|
|
let openpty = openpty(None, None).expect("Could not create openpty");
|
|
TestTerminal { openpty }
|
|
}
|
|
|
|
#[allow(dead_code)]
|
|
pub fn master(&self) -> RawFd {
|
|
self.openpty.master
|
|
}
|
|
|
|
pub fn slave(&self) -> RawFd {
|
|
self.openpty.slave
|
|
}
|
|
}
|
|
|
|
impl Drop for TestTerminal {
|
|
fn drop(&mut self) {
|
|
close(self.openpty.master).expect("Failed to close the master");
|
|
close(self.openpty.slave).expect("Failed to close the slave");
|
|
}
|
|
}
|
|
|
|
#[test]
|
|
fn get_cwd() {
|
|
let test_terminal = TestTerminal::new();
|
|
let test_termios =
|
|
termios::tcgetattr(test_terminal.slave()).expect("Could not configure the termios");
|
|
|
|
let server = ServerOsInputOutput {
|
|
orig_termios: Arc::new(Mutex::new(test_termios)),
|
|
client_senders: Arc::default(),
|
|
terminal_id_to_raw_fd: Arc::default(),
|
|
};
|
|
|
|
let pid = nix::unistd::getpid();
|
|
assert!(
|
|
server.get_cwd(pid).is_some(),
|
|
"Get current working directory from PID {}",
|
|
pid
|
|
);
|
|
}
|