diff options
author | iximeow <git@iximeow.net> | 2022-12-29 03:23:49 +0000 |
---|---|---|
committer | iximeow <git@iximeow.net> | 2022-12-29 03:23:49 +0000 |
commit | a7d2af2370ee186cdbf7f237a08754b9ed6991fd (patch) | |
tree | aef84fec24d1f5f61264d278de9c409ded3c4681 /src/lua | |
parent | f6da9d6b9ffcdb8a4a30d7d9f28dd37b4afb143c (diff) |
factor out io stuff
Diffstat (limited to 'src/lua')
-rw-r--r-- | src/lua/mod.rs | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/lua/mod.rs b/src/lua/mod.rs index 936c94a..26d2d5b 100644 --- a/src/lua/mod.rs +++ b/src/lua/mod.rs @@ -162,11 +162,15 @@ impl BuildEnv { .build() .unwrap(); rt.block_on(async move { - let artifact = job_ref.lock().unwrap().create_artifact(&name, &format!("{} (from {})", name, path.display())).await + let mut artifact = job_ref.lock().unwrap().create_artifact(&name, &format!("{} (from {})", name, path.display())).await .map_err(|e| LuaError::RuntimeError(format!("create_artifact error: {:?}", e))) .unwrap(); - crate::forward_data(tokio::fs::File::open(&format!("tmpdir/{}", path.display())).await.unwrap(), artifact).await - .map_err(|e| LuaError::RuntimeError(format!("failed uploading data for {}: {:?}", name, e))) + let mut file = tokio::fs::File::open(&format!("tmpdir/{}", path.display())).await.unwrap(); + eprintln!("uploading..."); + crate::io::forward_data(&mut file, &mut artifact).await + .map_err(|e| LuaError::RuntimeError(format!("failed uploading data for {}: {:?}", name, e)))?; + std::mem::drop(artifact); + Ok(()) }) }) .map_err(|e| format!("problem defining metric function: {:?}", e))?; |