From fad2c60605b67a44dc6d242cd99f6f79f1bd4b13 Mon Sep 17 00:00:00 2001 From: sigoden Date: Mon, 10 Feb 2025 14:47:37 +0800 Subject: refactor: improve run-agent/run-agent scripts (#160) --- scripts/run-tool.js | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) (limited to 'scripts/run-tool.js') diff --git a/scripts/run-tool.js b/scripts/run-tool.js index ea0b3a5..841fbc0 100755 --- a/scripts/run-tool.js +++ b/scripts/run-tool.js @@ -93,15 +93,10 @@ async function loadEnv(filePath) { } async function run(toolName, toolPath, toolFunc, toolData) { - let mod; if (os.platform() === "win32") { toolPath = `file://${toolPath}`; } - try { - mod = await import(toolPath); - } catch { - throw new Error(`Unable to load tool at '${toolPath}'`); - } + const mod = await import(toolPath); if (!mod || !mod[toolFunc]) { throw new Error(`Not module function '${toolFunc}' at '${toolPath}'`); } -- cgit v1.2.3