Skip to content

Commit

Permalink
server/pty: Crash if shell doesn't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
har7an committed Dec 13, 2022
1 parent 7c7fb98 commit 77a4e57
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 3 additions & 1 deletion zellij-server/src/os_input_output.rs
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,9 @@ fn handle_terminal(
// Create a pipe to allow the child the communicate the shell's pid to its
// parent.
match openpty(None, Some(&orig_termios)) {
Ok(open_pty_res) => handle_openpty(open_pty_res, cmd, quit_cb, terminal_id),
Ok(open_pty_res) => {
handle_openpty(open_pty_res, cmd, quit_cb, terminal_id).with_context(err_context)
},
Err(e) => match failover_cmd {
Some(failover_cmd) => {
handle_terminal(failover_cmd, None, orig_termios, quit_cb, terminal_id)
Expand Down
8 changes: 7 additions & 1 deletion zellij-server/src/pty.rs
Original file line number Diff line number Diff line change
Expand Up @@ -732,7 +732,13 @@ impl Pty {
},
Err(err) => match err.downcast_ref::<ZellijError>() {
Some(ZellijError::CommandNotFound { terminal_id, .. }) => {
new_pane_pids.push((*terminal_id, starts_held, None, Err(err)));
if self.task_handles.is_empty() {
// This instance of zellij is being spawned. If we find no
// terminal here, just bail out
Err::<(), _>(err).fatal();
} else {
new_pane_pids.push((*terminal_id, starts_held, None, Err(err)));
}
},
_ => {
Err::<(), _>(err).non_fatal();
Expand Down

0 comments on commit 77a4e57

Please sign in to comment.