with println

This commit is contained in:
Kasper Juul Hermansen 2023-02-17 15:17:28 +01:00
parent 4a4c03f3c2
commit d1726a052a
Signed by: kjuulh
GPG Key ID: 57B6E1465221F912
2 changed files with 20 additions and 2 deletions

View File

@ -89,17 +89,22 @@ impl InnerCliSession {
std::thread::spawn(move || { std::thread::spawn(move || {
let stdout_bufr = BufReader::new(stdout); let stdout_bufr = BufReader::new(stdout);
for line in stdout_bufr.lines() { for line in stdout_bufr.lines() {
let out = line.unwrap(); let out = line.as_ref().unwrap();
if let Ok(conn) = serde_json::from_str::<ConnectParams>(&out) { if let Ok(conn) = serde_json::from_str::<ConnectParams>(&out) {
sender.send(conn).unwrap(); sender.send(conn).unwrap();
} }
if let Ok(line) = line {
println!("dagger: {}", line);
}
} }
}); });
std::thread::spawn(|| { std::thread::spawn(|| {
let stderr_bufr = BufReader::new(stderr); let stderr_bufr = BufReader::new(stderr);
for line in stderr_bufr.lines() { for line in stderr_bufr.lines() {
let out = line.unwrap(); if let Ok(line) = line {
println!("dagger: {}", line);
}
//panic!("could not start dagger session: {}", out) //panic!("could not start dagger session: {}", out)
} }
}); });

View File

@ -0,0 +1,13 @@
fn main() -> eyre::Result<()> {
let client = dagger_sdk::client::connect()?;
let version = client
.container(None)
.from("golang:1.19".into())
.with_exec(vec!["go".into(), "version".into()], None)
.stdout();
println!("Hello from Dagger and {}", version.trim());
Ok(())
}