Run command from args params
This commit is contained in:
parent
5ddb43351b
commit
3279fb22cd
2 changed files with 13 additions and 2 deletions
|
@ -7,6 +7,14 @@ use libcommand::internal::{AuthorizeRequest};
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
#[tokio::main]
|
#[tokio::main]
|
||||||
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
// let arg = std::env::args()
|
||||||
|
// .skip(1)
|
||||||
|
// .next().unwrap();
|
||||||
|
let arg = String::from("{\"command\": \"nu\", \"envs\": {}, \"args\": []}");
|
||||||
|
let mut command : std::process::Command = serde_json::from_str::<libcommand::Command>(&arg)
|
||||||
|
.unwrap()
|
||||||
|
.into();
|
||||||
|
|
||||||
let mut client = client::connect().await?;
|
let mut client = client::connect().await?;
|
||||||
|
|
||||||
let request = tonic::Request::new(AuthorizeRequest {
|
let request = tonic::Request::new(AuthorizeRequest {
|
||||||
|
@ -18,6 +26,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
|
||||||
|
|
||||||
println!("RESPONSE={:?}", response);
|
println!("RESPONSE={:?}", response);
|
||||||
|
|
||||||
|
let mut child = command.spawn().unwrap();
|
||||||
|
child.wait().unwrap();
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2,10 +2,10 @@
|
||||||
|
|
||||||
#[cfg(unix)]
|
#[cfg(unix)]
|
||||||
use tonic::transport::server::UdsConnectInfo;
|
use tonic::transport::server::UdsConnectInfo;
|
||||||
use tonic::{transport::Server, Request, Response, Status};
|
use tonic::{Request, Response, Status};
|
||||||
|
|
||||||
use libcommand::internal::{
|
use libcommand::internal::{
|
||||||
unix_server::{Unix, UnixServer},
|
unix_server::Unix,
|
||||||
AuthorizeRequest, AuthorizeResponse, TerminateRequest, TerminateResponse
|
AuthorizeRequest, AuthorizeResponse, TerminateRequest, TerminateResponse
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
Reference in a new issue