mirror of
https://github.com/jparkerweb/plan2code.git
synced 2026-12-06 00:15:42 -08:00
Review fixes: name a slow shell, stop orphaned dashboards, bound quit stops, serialize pty tests
AI Assisted
This commit is contained in:
1 parent
0bd721fc27
commit
f640f890f4
10 files changed
+412
-75
No files matched your search
@@ -4,7 +4,7 @@
|
||||
|
||||
use std::path::PathBuf;
|
||||
use std::sync::mpsc::{channel, Receiver, RecvTimeoutError};
|
||||
use std::sync::{Arc, Mutex, Once};
|
||||
use std::sync::{Arc, Mutex, MutexGuard, Once};
|
||||
use std::time::{Duration, Instant};
|
||||
|
||||
use plan2code_app_lib::agent_manager::{AgentEvent, AgentManager, AgentSnapshot, AgentState};
|
||||
@@ -27,10 +27,21 @@ struct Harness {
|
||||
states: Vec<AgentSnapshot>,
|
||||
/// How many of `states` `wait_state` has already looked at.
|
||||
cursor: usize,
|
||||
/// Held for the whole test, and dropped last: see `PTY_LOCK`.
|
||||
_pty: MutexGuard<'static, ()>,
|
||||
}
|
||||
|
||||
/// One test at a time opens pseudo-terminals here. Run side by side, macOS
|
||||
/// `openpty` fails now and then (`Unknown error: -6`, a different test each
|
||||
/// run), which reads as a broken agent start. Every test takes it through
|
||||
/// `Harness::new`; a panicked test leaves it poisoned, which is harmless.
|
||||
static PTY_LOCK: Mutex<()> = Mutex::new(());
|
||||
|
||||
impl Harness {
|
||||
fn new() -> Harness {
|
||||
let pty = PTY_LOCK
|
||||
.lock()
|
||||
.unwrap_or_else(|poisoned| poisoned.into_inner());
|
||||
static BIN: Once = Once::new();
|
||||
BIN.call_once(|| std::env::set_var(AGENT_BIN_ENV, common::fake_agent()));
|
||||
let (tx, rx) = channel();
|
||||
@@ -44,6 +55,7 @@ impl Harness {
|
||||
seen: String::new(),
|
||||
states: Vec::new(),
|
||||
cursor: 0,
|
||||
_pty: pty,
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user