Skip to content

Commit

Permalink
only kill current context if is len > 1
Browse files Browse the repository at this point in the history
  • Loading branch information
raphamorim committed Aug 1, 2023
1 parent 434dbf4 commit 6b6f2d9
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion rio/src/screen/context.rs
Original file line number Diff line number Diff line change
Expand Up @@ -347,12 +347,16 @@ impl<T: EventListener + Clone + std::marker::Send + 'static> ContextManager<T> {

#[inline]
pub fn kill_current_context(&mut self) {
if self.contexts.len() <= 1 {
self.current_index = 0;
return;
}

let index_to_remove = self.current_index;

#[cfg(not(target_os = "windows"))]
{
let pid = self.contexts[index_to_remove].shell_pid;
println!("closing pid {}", pid);
if pid > 0 {
teletypewriter::kill_pid(pid as i32);
}
Expand Down

0 comments on commit 6b6f2d9

Please sign in to comment.