Implement PTY-native session terminal control
This commit is contained in:
parent
058e58e816
commit
8cef037fa3
1 changed files with 1488 additions and 382 deletions
|
|
@ -14,13 +14,13 @@ use lazaret_core::identity::{
|
|||
};
|
||||
use lazaret_core::protocol::VerifiedSession;
|
||||
use lazaret_core::records::{
|
||||
DeveloperDecision, DomainStore, DurableDecision, GuestProcessIdentity, InteractiveSessionBatch,
|
||||
InteractiveSessionEvent, InteractiveSessionMessage, InteractiveSessionRequest,
|
||||
ParticipantOwnership, ParticipantRole, ParticipantState, PersistedHostProcessOwnership,
|
||||
ProcessOwnershipCommitAck, ProtocolVersion, PtyIdentity, SessionExit, SessionPhase,
|
||||
SessionTerminal, SessionTerminalEvent, SessionTerminalFields, SessionTerminalMessage,
|
||||
SessionTerminalState, StagedProcessOwnership, TerminalOutput, TerminalPrompt, TerminalResize,
|
||||
TerminalSignalKind,
|
||||
DeveloperDecision, DomainStore, DurableDecision, GuestProcessIdentity,
|
||||
InteractiveProtocolVersion, InteractiveSessionBatchV2, InteractiveSessionEventV2,
|
||||
InteractiveSessionMessage, InteractiveSessionRequestV2, ParticipantOwnership, ParticipantRole,
|
||||
ParticipantState, PersistedHostProcessOwnership, ProcessOwnershipCommitAck, PtyIdentity,
|
||||
SessionExit, SessionPhase, SessionTerminal, SessionTerminalEventV2, SessionTerminalFields,
|
||||
SessionTerminalMessage, SessionTerminalState, StagedProcessOwnership, TerminalModesV2,
|
||||
TerminalOutput, TerminalPrompt, TerminalResize,
|
||||
};
|
||||
use lazaret_linux::process::{
|
||||
ChildStandardIo, ProcessExit, ProcessOwnershipContext, RetainedProcess, TargetCommand,
|
||||
|
|
@ -29,7 +29,10 @@ use lazaret_linux::process::{
|
|||
use lazaret_sandbox_contract::SANDBOX_INIT_DESTINATION;
|
||||
use rustix::fs::{OFlags, fcntl_getfl, fcntl_setfl, fstat};
|
||||
use rustix::pty::{OpenptFlags, grantpt, ioctl_tiocgptpeer, openpt, unlockpt};
|
||||
use rustix::termios::{Winsize, tcsetwinsize};
|
||||
use rustix::termios::{
|
||||
ControlModes, InputModes, LocalModes, OptionalActions, OutputModes, SpecialCodeIndex, Winsize,
|
||||
tcgetattr, tcsendbreak, tcsetattr, tcsetwinsize,
|
||||
};
|
||||
use sha2::{Digest, Sha256};
|
||||
|
||||
use crate::control::{ControlError, InteractiveControlSession, InteractiveSessionExecutor};
|
||||
|
|
@ -440,6 +443,7 @@ impl PromptRouteCancellation for SessionPromptTransport {
|
|||
pub trait SessionTerminalProcess: Send {
|
||||
fn write_input(&mut self, bytes: &[u8]) -> io::Result<usize>;
|
||||
fn resize(&self, resize: TerminalResize) -> io::Result<()>;
|
||||
fn send_break(&self) -> io::Result<()>;
|
||||
fn read_output(&mut self, bytes: &mut [u8]) -> io::Result<usize>;
|
||||
fn exec_exited(&self) -> io::Result<bool>;
|
||||
fn signal_group(&self, signal: &str) -> Result<(), TerminalError>;
|
||||
|
|
@ -471,6 +475,8 @@ pub struct TerminalAcquisition {
|
|||
pub environment: BTreeMap<String, EnvironmentValue>,
|
||||
pub internal_pid_file: PathBuf,
|
||||
pub argv: Vec<Vec<u8>>,
|
||||
pub initial_size: TerminalResize,
|
||||
pub initial_modes: TerminalModesV2,
|
||||
}
|
||||
|
||||
pub struct HostCoordinatorTerminalRecorder {
|
||||
|
|
|
|||
Loading…
Reference in a new issue