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:
+16
-1
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user