From e9e346cc2d66eb147596c76968c91a7a35a3d924 Mon Sep 17 00:00:00 2001 From: Jeroen Schweitzer Date: Sun, 26 Apr 2026 15:07:25 +0200 Subject: [PATCH] add ptyc spawn test to toolchain category Sends a valid JSON request to ptyc via stdin, verifies it parses the request (exit 2 = syscall failed, not exit 1 = bad request). Full PTY setup needs socketpair/SCM_RIGHTS which only PtySession provides. Co-Authored-By: Claude Opus 4.6 (1M context) --- .pql/pql-plan.json | 2 +- lib/test_app.dart | 11 +++++++++++ 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/.pql/pql-plan.json b/.pql/pql-plan.json index cc20ac3b..3fcc12b6 100644 --- a/.pql/pql-plan.json +++ b/.pql/pql-plan.json @@ -1,5 +1,5 @@ { - "exported_at": "2026-04-26T12:16:59Z", + "exported_at": "2026-04-26T13:07:25Z", "decisions": [ { "id": "D-1", diff --git a/lib/test_app.dart b/lib/test_app.dart index cd3bbf6e..4b56e1a0 100644 --- a/lib/test_app.dart +++ b/lib/test_app.dart @@ -173,6 +173,17 @@ class _ClideTestAppState extends State { return 'exit=${r.exitCode} ${(r.stdout as String).trim()}'; }); + // ptyc stdin/stdout test — send a valid request, verify JSON response + await _testAsync('ptyc spawn echo', () async { + final proc = await Process.start(tc.ptyc, []); + // Send a request for /bin/echo — simplest possible child + proc.stdin.write('{"argv":["/bin/echo","hello"],"cwd":"/tmp","env":{},"cols":80,"rows":24}'); + await proc.stdin.close(); + final stdout = await proc.stdout.transform(const SystemEncoding().decoder).join(); + final exitCode = await proc.exitCode; + return 'exit=$exitCode stdout=${stdout.trim().split('\n').first}'; + }); + print('[testmode]'); }