F3: suspended Phpactor start, ConPTY shell in a job, cancel superseded completions, syntax proptest
- lutra_proc::spawn_suspended: CREATE_SUSPENDED, join the kill-on-close job, resume via a Tool Help thread snapshot. Opt-in for long-lived children (Phpactor); git, php -l and the probe keep spawn because the snapshot costs ~60 ms per start. - lutra_proc::adopt + Guard (Windows): the terminal's ConPTY shell joins a job, so processes it started end with the tab or with Lutra. - lsp.completion cancels the previous pending completion on the same server ($/cancelRequest); the cancelled command resolves empty. - Syntax proptests compare leaf kinds, outline and folding instead of the S-expression (tree-sitter-php 0.25.1 keeps a union_type wrapper after an undo); Malte's seed added. - docs/development.md: data dirs, target dir inside the repo, parallel builds, deleting ui/node_modules. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
7ad3005217
commit
ebbc89832c
17 changed files with 468 additions and 36 deletions
|
|
@ -8,7 +8,7 @@
|
|||
|
||||
#![allow(clippy::unwrap_used)]
|
||||
|
||||
use std::io::{BufRead, BufReader, Read};
|
||||
use std::io::{BufRead, BufReader, Read, Write};
|
||||
use std::process::{ChildStdout, Command, Stdio};
|
||||
use std::sync::mpsc;
|
||||
use std::thread;
|
||||
|
|
@ -101,3 +101,37 @@ fn a_missing_program_is_an_error() {
|
|||
let error = lutra_proc::spawn(Command::new("lutra-proc-no-such-program")).unwrap_err();
|
||||
assert_eq!(error.kind(), std::io::ErrorKind::NotFound);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn a_suspended_start_runs_and_takes_the_whole_tree() {
|
||||
let mut child = lutra_proc::spawn_suspended(helper("unknown-role")).unwrap();
|
||||
assert_eq!(child.wait().unwrap().code(), Some(2));
|
||||
let mut parent = lutra_proc::spawn_suspended(helper("tree-plain")).unwrap();
|
||||
let reader = ready(parent.stdout.take().unwrap());
|
||||
drop(parent);
|
||||
assert_gone(reader);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn hard_kill_works_when_a_suspended_start_parent_guards_its_child() {
|
||||
let mut parent = lutra_proc::spawn_suspended(helper("tree-proc")).unwrap();
|
||||
let reader = ready(parent.stdout.take().unwrap());
|
||||
std::process::Child::kill(&mut parent).unwrap();
|
||||
parent.wait().unwrap();
|
||||
assert_gone(reader);
|
||||
}
|
||||
|
||||
#[cfg(windows)]
|
||||
#[test]
|
||||
fn dropping_an_adopt_guard_takes_the_tree_started_after_it() {
|
||||
use std::os::windows::io::AsRawHandle;
|
||||
let mut command = helper("tree-on-input");
|
||||
command.stdin(Stdio::piped());
|
||||
let mut parent = command.spawn().unwrap();
|
||||
let guard = lutra_proc::adopt(parent.as_raw_handle()).unwrap();
|
||||
parent.stdin.take().unwrap().write_all(b"go\n").unwrap();
|
||||
let reader = ready(parent.stdout.take().unwrap());
|
||||
drop(guard);
|
||||
assert_gone(reader);
|
||||
parent.wait().unwrap();
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue