mirror of
https://github.com/kjuulh/dagger-rs.git
synced 2024-11-26 00:42:42 +01:00
fix(core): cli session keep session alive
This commit is contained in:
parent
085a998bc6
commit
8dfecf976c
@ -1,8 +1,7 @@
|
|||||||
use std::{
|
use std::{
|
||||||
fs::canonicalize,
|
fs::canonicalize,
|
||||||
io::{BufRead, BufReader},
|
|
||||||
path::PathBuf,
|
path::PathBuf,
|
||||||
process::{Child, Stdio},
|
process::Stdio,
|
||||||
sync::Arc,
|
sync::Arc,
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -89,25 +88,20 @@ impl InnerCliSession {
|
|||||||
let (sender, mut receiver) = tokio::sync::mpsc::channel(1);
|
let (sender, mut receiver) = tokio::sync::mpsc::channel(1);
|
||||||
|
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
let stdout_bufr = tokio::io::BufReader::new(stdout);
|
let mut stdout_bufr = tokio::io::BufReader::new(stdout).lines();
|
||||||
for line in stdout_bufr.lines().next_line().await {
|
while let Ok(Some(line)) = stdout_bufr.next_line().await {
|
||||||
let out = line.as_ref().unwrap();
|
if let Ok(conn) = serde_json::from_str::<ConnectParams>(&line) {
|
||||||
if let Ok(conn) = serde_json::from_str::<ConnectParams>(&out) {
|
|
||||||
sender.send(conn).await.unwrap();
|
sender.send(conn).await.unwrap();
|
||||||
}
|
}
|
||||||
if let Some(line) = line {
|
|
||||||
println!("dagger: {}", line);
|
println!("dagger: {}", line);
|
||||||
}
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
tokio::spawn(async move {
|
tokio::spawn(async move {
|
||||||
let stdout_bufr = tokio::io::BufReader::new(stderr);
|
let mut stdout_bufr = tokio::io::BufReader::new(stderr).lines();
|
||||||
for line in stdout_bufr.lines().next_line().await {
|
while let Ok(Some(line)) = stdout_bufr.next_line().await {
|
||||||
if let Some(line) = line {
|
println!("dagger: {}", line);
|
||||||
println!("dagger: {}", line);
|
|
||||||
}
|
|
||||||
//panic!("could not start dagger session: {}", out)
|
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user