resolve ptyc path relative to daemon binary

The daemon now checks for ptyc at ../ptyc/bin/ptyc relative to its
own binary location before falling back to PATH lookup. Fixes
"ProcessException: No such file or directory. Command: ptyc" when
ptyc is built but not on PATH.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-04-22 23:44:00 +02:00
co-authored by Claude Opus 4.6
parent b581ed3fe8
commit f71f2bce7c
2 changed files with 20 additions and 5 deletions
+16 -1
View File
@@ -142,9 +142,10 @@ Future<void> _runDaemon(List<String> args) async {
socketPath: socketPath,
dispatch: dispatcher.dispatch,
);
final ptycPath = _resolvePtycPath();
final events = _ServerEventSink(server);
final registry = PaneRegistry(events: events);
registerPaneCommands(dispatcher, registry);
registerPaneCommands(dispatcher, registry, defaultPtycPath: ptycPath);
final files = FilesService.atCwd(events: events);
registerFilesCommands(dispatcher, files);
@@ -423,6 +424,20 @@ void _emitError({
stderr.writeln(jsonEncode(err.toJson()));
}
String _resolvePtycPath() {
final self = Platform.resolvedExecutable;
final binDir = File(self).parent.path;
final candidates = [
'$binDir/../ptyc/bin/ptyc',
'$binDir/ptyc',
'ptyc',
];
for (final c in candidates) {
if (File(c).existsSync()) return c;
}
return 'ptyc';
}
Never _die(String msg) {
_emitError(
code: IpcExitCode.userError,