1
0
Fork 0
This repository has been archived on 2024-01-05. You can view files and clone it, but cannot push or open issues or pull requests.
command_gateway/src/client/main.rs

38 lines
No EOL
943 B
Rust

#![cfg_attr(not(unix), allow(unused_imports))]
pub mod client;
use libcommand::internal::{AuthorizeRequest, AuthorizeResponse};
use tonic::Response;
#[cfg(unix)]
#[tokio::main]
async fn main() -> Result<(), Box<dyn std::error::Error>> {
let arg = std::env::args()
.skip(1)
.last().unwrap();
let mut command : std::process::Command = serde_json::from_str::<libcommand::Command>(&arg)
.unwrap()
.into();
let mut client = client::connect().await?;
let request = tonic::Request::new(AuthorizeRequest {
identifier: "Tonic".into(),
public_ssh_keys: "Tonic".into(),
});
let response : Response<AuthorizeResponse> = client.authorize(request).await?;
println!("RESPONSE={:?}", response);
let mut child = command.spawn().unwrap();
child.wait().unwrap();
Ok(())
}
#[cfg(not(unix))]
fn main() {
panic!("The `uds` example only works on unix systems!");
}