diff options
| author | Kunal Mohan <kunalmohan99@gmail.com> | 2021-03-18 22:37:25 +0530 |
|---|---|---|
| committer | Kunal Mohan <kunalmohan99@gmail.com> | 2021-05-04 20:47:51 +0530 |
| commit | 0d814ebcde98659babeaaa71a3ad5ee720021fc4 (patch) | |
| tree | 28b136c7ebde8f00375712c3fcec38992e81a60e /src/common/errors.rs | |
| parent | wip: remove the commands that are called only on the client (diff) | |
| download | sl0ppij-0d814ebcde98659babeaaa71a3ad5ee720021fc4.tar.gz sl0ppij-0d814ebcde98659babeaaa71a3ad5ee720021fc4.tar.xz sl0ppij-0d814ebcde98659babeaaa71a3ad5ee720021fc4.zip | |
Divide OsApi into ClientOsApi and ServerOsApi and move calls to os thread
Diffstat (limited to 'src/common/errors.rs')
| -rw-r--r-- | src/common/errors.rs | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/src/common/errors.rs b/src/common/errors.rs index 3b5c8354..4259600f 100644 --- a/src/common/errors.rs +++ b/src/common/errors.rs @@ -1,7 +1,7 @@ //! Error context system based on a thread-local representation of the call stack, itself based on //! the instructions that are sent between threads. -use super::{os_input_output::OsApiInstruction, AppInstruction, OPENCALLS}; +use super::{os_input_output::ServerOsApiInstruction, AppInstruction, OPENCALLS}; use crate::pty_bus::PtyInstruction; use crate::screen::ScreenInstruction; use serde::{Deserialize, Serialize}; @@ -297,26 +297,21 @@ impl From<&PtyInstruction> for PtyContext { #[derive(Debug, Clone, Copy, PartialEq, Serialize, Deserialize)] pub enum OsContext { - SpawnTerminal, - GetTerminalSizeUsingFd, SetTerminalSizeUsingFd, - SetRawMode, - UnsetRawMode, - ReadFromTtyStdout, WriteToTtyStdin, TcDrain, - Kill, - ReadFromStdin, - GetStdoutWriter, - BoxClone, + Exit, } -impl From<&OsApiInstruction> for OsContext { - fn from(os_instruction: &OsApiInstruction) -> Self { +impl From<&ServerOsApiInstruction> for OsContext { + fn from(os_instruction: &ServerOsApiInstruction) -> Self { match *os_instruction { - OsApiInstruction::SetTerminalSizeUsingFd(_, _, _) => OsContext::SetTerminalSizeUsingFd, - OsApiInstruction::WriteToTtyStdin(_, _) => OsContext::WriteToTtyStdin, - OsApiInstruction::TcDrain(_) => OsContext::TcDrain, + ServerOsApiInstruction::SetTerminalSizeUsingFd(_, _, _) => { + OsContext::SetTerminalSizeUsingFd + } + ServerOsApiInstruction::WriteToTtyStdin(_, _) => OsContext::WriteToTtyStdin, + ServerOsApiInstruction::TcDrain(_) => OsContext::TcDrain, + ServerOsApiInstruction::Exit => OsContext::Exit, } } } @@ -356,6 +351,7 @@ pub enum AppContext { ToPlugin, ToScreen, DoneClosingPane, + OsApi, } impl From<&AppInstruction> for AppContext { @@ -364,6 +360,7 @@ impl From<&AppInstruction> for AppContext { AppInstruction::Exit => AppContext::Exit, AppInstruction::Error(_) => AppContext::Error, AppInstruction::ToPty(_) => AppContext::ToPty, + AppInstruction::OsApi(_) => AppContext::OsApi, AppInstruction::ToPlugin(_) => AppContext::ToPlugin, AppInstruction::ToScreen(_) => AppContext::ToScreen, AppInstruction::DoneClosingPane => AppContext::DoneClosingPane, |
