diff --git a/.pql/pql-plan.json b/.pql/pql-plan.json index 741bf004..0e39e917 100644 --- a/.pql/pql-plan.json +++ b/.pql/pql-plan.json @@ -1,5 +1,5 @@ { - "exported_at": "2026-04-30T18:30:16Z", + "exported_at": "2026-04-30T20:42:24Z", "decisions": [ { "id": "D-1", diff --git a/lib/src/pty/native_pty.dart b/lib/src/pty/native_pty.dart index 026584c4..e03153bb 100644 --- a/lib/src/pty/native_pty.dart +++ b/lib/src/pty/native_pty.dart @@ -11,7 +11,7 @@ library; import 'dart:async'; import 'dart:ffi' as ffi; -import 'dart:io' show Platform; +import 'dart:io' show File, Platform; import 'dart:isolate'; import 'dart:typed_data'; @@ -120,6 +120,19 @@ class NativePty { String? workingDirectory, Map environment = const {}, }) { + // Resolve bare command names via PATH (execve doesn't search PATH). + if (!executable.contains('/')) { + final path = environment['PATH'] ?? Platform.environment['PATH'] ?? ''; + for (final dir in path.split(':')) { + if (dir.isEmpty) continue; + final candidate = '$dir/$executable'; + if (File(candidate).existsSync()) { + executable = candidate; + break; + } + } + } + // Force-resolve FFI functions that run in the child process. // Top-level finals are lazy; touching them here ensures the FFI // trampolines are compiled before fork() clones the process.