Adding runner handshake

This commit is contained in:
Sebastian authored and Hakan Seven committed 2026-06-28 10:41:01 +03:00
1 parent d209e7bbb5
commit 04240862e1
5 files changed
+114 -4

No files matched your search

+10 -1
View File
@@ -13,7 +13,7 @@ use std::rc::Rc;
use crate::host::{BuiltinPlugin, InteractiveCommand};
use crate::ipc::client::{InteractiveRegistry, IpcClient, PluginHostApi};
use crate::ipc::protocol::{
HostRequest, HostResponse, HostToPlugin, InteractiveEvent, PluginToHost,
HostRequest, HostResponse, HostToPlugin, InteractiveEvent, PluginToHost, PLUGIN_TOKEN_ENV,
};
use crate::ipc::transport::{recv, send};
use crate::ribbon::owned::OwnedRibbonGroup;
@@ -29,8 +29,17 @@ pub fn run(socket_name: &str, cdylib_path: &Path) -> Result<(), Box<dyn std::err
let plugin = unsafe { load_plugin(cdylib_path)? };
let interactive: InteractiveRegistry = Rc::new(RefCell::new(HashMap::new()));
let token = match std::env::var(PLUGIN_TOKEN_ENV) {
Ok(t) => t,
Err(_) => {
eprintln!("[runner] missing {PLUGIN_TOKEN_ENV}; exiting");
std::process::exit(1);
}
};
let client = IpcClient::connect(socket_name)?;
eprintln!("[runner] connected to host");
client.send_handshake(&token)?;
loop {
let msg: HostToPlugin = recv(&mut client.stream_ref())?;