mirror of
https://github.com/openai/codex.git
synced 2026-05-01 11:52:10 +03:00
Add exec-server transport for unified exec
This commit is contained in:
@@ -79,6 +79,7 @@ pub struct ProcessHandle {
|
||||
wait_handle: StdMutex<Option<JoinHandle<()>>>,
|
||||
exit_status: Arc<AtomicBool>,
|
||||
exit_code: Arc<StdMutex<Option<i32>>>,
|
||||
pid: Option<u32>,
|
||||
// PtyHandles must be preserved because the process will receive Control+C if the
|
||||
// slave is closed
|
||||
_pty_handles: StdMutex<Option<PtyHandles>>,
|
||||
@@ -101,6 +102,7 @@ impl ProcessHandle {
|
||||
wait_handle: JoinHandle<()>,
|
||||
exit_status: Arc<AtomicBool>,
|
||||
exit_code: Arc<StdMutex<Option<i32>>>,
|
||||
pid: Option<u32>,
|
||||
pty_handles: Option<PtyHandles>,
|
||||
) -> Self {
|
||||
Self {
|
||||
@@ -112,6 +114,7 @@ impl ProcessHandle {
|
||||
wait_handle: StdMutex::new(Some(wait_handle)),
|
||||
exit_status,
|
||||
exit_code,
|
||||
pid,
|
||||
_pty_handles: StdMutex::new(pty_handles),
|
||||
}
|
||||
}
|
||||
@@ -139,6 +142,11 @@ impl ProcessHandle {
|
||||
self.exit_code.lock().ok().and_then(|guard| *guard)
|
||||
}
|
||||
|
||||
/// Returns the OS process ID when known.
|
||||
pub fn pid(&self) -> Option<u32> {
|
||||
self.pid
|
||||
}
|
||||
|
||||
/// Resize the PTY in character cells.
|
||||
pub fn resize(&self, size: TerminalSize) -> anyhow::Result<()> {
|
||||
let handles = self
|
||||
|
||||
Reference in New Issue
Block a user