migrate to rust
This commit is contained in:
19
src/cmd/bootstrap.rs
Normal file
19
src/cmd/bootstrap.rs
Normal file
@ -0,0 +1,19 @@
|
||||
use eyre::Result;
|
||||
use tokio::{fs, io, io::AsyncWriteExt};
|
||||
|
||||
pub async fn run() -> Result<()> {
|
||||
let mut input = io::stdin();
|
||||
let mut out = fs::File::create("/bootstrap.tar.part").await?;
|
||||
|
||||
let n = io::copy(&mut input, &mut out).await?;
|
||||
|
||||
out.flush().await?;
|
||||
drop(out);
|
||||
|
||||
eprintln!("copied {n} bytes");
|
||||
|
||||
fs::rename("/bootstrap.tar.part", "/bootstrap.tar").await?;
|
||||
eprintln!("/bootstrap.tar ready to use");
|
||||
|
||||
Ok(())
|
||||
}
|
Reference in New Issue
Block a user