mirror of
https://github.com/openai/codex.git
synced 2026-05-01 20:02:05 +03:00
add js_repl polling and reuse unified_exec managed process substrate
This commit is contained in:
@@ -77,11 +77,10 @@ async fn run_codex_cli(
|
||||
let mut output = Vec::new();
|
||||
let codex_utils_pty::SpawnedProcess {
|
||||
session,
|
||||
stdout_rx,
|
||||
stderr_rx,
|
||||
output_rx,
|
||||
exit_rx,
|
||||
} = spawned;
|
||||
let mut output_rx = codex_utils_pty::combine_output_receivers(stdout_rx, stderr_rx);
|
||||
let mut output_rx = output_rx;
|
||||
let mut exit_rx = exit_rx;
|
||||
let writer_tx = session.writer_sender();
|
||||
let exit_code_result = timeout(Duration::from_secs(10), async {
|
||||
@@ -90,7 +89,7 @@ async fn run_codex_cli(
|
||||
loop {
|
||||
select! {
|
||||
result = output_rx.recv() => match result {
|
||||
Ok(chunk) => {
|
||||
Some(chunk) => {
|
||||
// The TUI asks for the cursor position via ESC[6n.
|
||||
// Respond with a valid position to unblock startup.
|
||||
if chunk.windows(4).any(|window| window == b"\x1b[6n") {
|
||||
@@ -98,8 +97,7 @@ async fn run_codex_cli(
|
||||
}
|
||||
output.extend_from_slice(&chunk);
|
||||
}
|
||||
Err(tokio::sync::broadcast::error::RecvError::Closed) => break exit_rx.await,
|
||||
Err(tokio::sync::broadcast::error::RecvError::Lagged(_)) => {}
|
||||
None => break exit_rx.await,
|
||||
},
|
||||
result = &mut exit_rx => break result,
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user