From 809443db2658647fa185573676eb40e8039ebe13 Mon Sep 17 00:00:00 2001 From: Alfredo Gallardo Date: Thu, 28 Nov 2024 12:17:19 -0300 Subject: [PATCH] - fix: tests --- libs/shinkai-tools-runner/src/built_in_tools.test.rs | 9 +-------- libs/shinkai-tools-runner/src/copy_assets.rs | 2 +- libs/shinkai-tools-runner/src/tools/deno_runner.rs | 6 ++++-- libs/shinkai-tools-runner/src/tools/tool.rs | 2 +- 4 files changed, 7 insertions(+), 12 deletions(-) diff --git a/libs/shinkai-tools-runner/src/built_in_tools.test.rs b/libs/shinkai-tools-runner/src/built_in_tools.test.rs index c084707..10475f2 100644 --- a/libs/shinkai-tools-runner/src/built_in_tools.test.rs +++ b/libs/shinkai-tools-runner/src/built_in_tools.test.rs @@ -1,11 +1,4 @@ -use std::collections::HashMap; - -use serde_json::Value; - -use crate::{ - built_in_tools::{get_tool, get_tools}, - tools::code_files::CodeFiles, -}; +use crate::built_in_tools::{get_tool, get_tools}; #[tokio::test] async fn list_tools_count() { diff --git a/libs/shinkai-tools-runner/src/copy_assets.rs b/libs/shinkai-tools-runner/src/copy_assets.rs index f8554d3..b4cc824 100644 --- a/libs/shinkai-tools-runner/src/copy_assets.rs +++ b/libs/shinkai-tools-runner/src/copy_assets.rs @@ -5,7 +5,7 @@ use std::io::Write; use std::path::Path; use std::path::PathBuf; -pub static DENO_VERSION: &str = "v2.0.4"; +pub static DENO_VERSION: &str = "v2.1.1"; static PROFILE: Lazy = Lazy::new(|| std::env::var("PROFILE").unwrap_or_else(|_| "debug".to_string())); diff --git a/libs/shinkai-tools-runner/src/tools/deno_runner.rs b/libs/shinkai-tools-runner/src/tools/deno_runner.rs index 7c2fa44..a1b9e21 100644 --- a/libs/shinkai-tools-runner/src/tools/deno_runner.rs +++ b/libs/shinkai-tools-runner/src/tools/deno_runner.rs @@ -330,7 +330,7 @@ impl DenoRunner { }); #[allow(clippy::let_underscore_future)] - let _ = tokio::spawn(async move { + let std_tasks = tokio::spawn(async move { let _ = futures::future::join_all(vec![stdout_task, stderr_task]).await; }); @@ -350,6 +350,7 @@ impl DenoRunner { log::info!("executing command without timeout"); child.wait_with_output().await? }; + let _ = std_tasks.await; if !output.status.success() { let stderr = stderr_lines.lock().await.to_vec().join("\n"); log::error!("command execution failed: {}", stderr); @@ -489,7 +490,7 @@ impl DenoRunner { }); #[allow(clippy::let_underscore_future)] - let _ = tokio::spawn(async move { + let std_tasks = tokio::spawn(async move { let _ = futures::future::join_all(vec![stdout_task, stderr_task]).await; }); @@ -509,6 +510,7 @@ impl DenoRunner { log::info!("executing command without timeout"); child.wait_with_output().await? }; + let _ = std_tasks.await; if !output.status.success() { let stderr = stderr_lines.lock().await.to_vec().join("\n"); log::error!("command execution failed: {}", stderr); diff --git a/libs/shinkai-tools-runner/src/tools/tool.rs b/libs/shinkai-tools-runner/src/tools/tool.rs index 1506a9d..d0250fa 100644 --- a/libs/shinkai-tools-runner/src/tools/tool.rs +++ b/libs/shinkai-tools-runner/src/tools/tool.rs @@ -4,7 +4,7 @@ use serde_json::Value; use super::{ code_files::CodeFiles, deno_runner::DenoRunner, deno_runner_options::DenoRunnerOptions, - execution_error::ExecutionError, run_result::RunResult, tool_definition::ToolDefinition, + execution_error::ExecutionError, run_result::RunResult, }; pub struct Tool {