use pai::api::messages::{CbAction, LogFormat, LogOutput};
use pai::ctx;
fn main() -> anyhow::Result<()> {
env_logger::init();
let cmd = std::process::Command::new("true");
let mut ctx: ctx::Main<(), pai::Error> = ctx::Main::new_spawn(cmd, ())?;
let sec = ctx.secondary_mut();
let f = LogOutput::file("logging.txt");
sec.client_mut().add_logger(LogFormat::Json, f)?;
#[cfg(feature = "syscalls")]
sec.set_generic_syscall_handler_exit(|_cl, sys| {
println!("{sys}");
Ok(CbAction::None)
});
ctx.loop_until_exit()?;
Ok(())
}