From 019daa8b69b2e3b402362b71eeb3c8408c2ab933 Mon Sep 17 00:00:00 2001 From: Niklas Claesson Date: Wed, 25 Jan 2017 00:19:45 +0100 Subject: Add support for -e argument --- src/tty.rs | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/tty.rs') diff --git a/src/tty.rs b/src/tty.rs index 99f1239e..4fcf065f 100644 --- a/src/tty.rs +++ b/src/tty.rs @@ -26,6 +26,7 @@ use libc::{self, winsize, c_int, pid_t, WNOHANG, WIFEXITED, WEXITSTATUS, SIGCHLD use term::SizeInfo; use display::OnResize; use config::{Config, Shell}; +use cli::Options; /// Process ID of child process /// @@ -179,15 +180,17 @@ fn get_pw_entry(buf: &mut [i8; 1024]) -> Passwd { } /// Create a new tty and return a handle to interact with it. -pub fn new(config: &Config, size: T) -> Pty { +pub fn new(config: &Config, options: &Options, size: T) -> Pty { let win = size.to_winsize(); let mut buf = [0; 1024]; let pw = get_pw_entry(&mut buf); let (master, slave) = openpty(win.ws_row as _, win.ws_col as _); - let default_shell = Shell::new(pw.shell); - let shell = config.shell().unwrap_or(&default_shell); + let default_shell = &Shell::new(pw.shell); + let shell = options.shell() + .or_else(|| config.shell()) + .unwrap_or(&default_shell); let mut builder = Command::new(shell.program()); for arg in shell.args() { -- cgit