From 67c45c29734edb9202d743d4e1069222e0f81d71 Mon Sep 17 00:00:00 2001 From: sigoden Date: Thu, 12 Dec 2024 09:26:19 +0800 Subject: [PATCH] fix: git bash on windows backslashs bug --- scripts/run-agent.sh | 1 + scripts/run-mcp-tool.sh | 9 +++++++++ scripts/run-tool.sh | 1 + 3 files changed, 11 insertions(+) diff --git a/scripts/run-agent.sh b/scripts/run-agent.sh index ff9849f..d7f9a20 100755 --- a/scripts/run-agent.sh +++ b/scripts/run-agent.sh @@ -62,6 +62,7 @@ run() { if [[ "$OS" == "Windows_NT" ]]; then set -o igncr tools_path="$(cygpath -w "$tools_path")" + tool_data="$(echo "$tool_data" | sed 's/\\/\\\\/g')" fi jq_script="$(cat <<-'EOF' diff --git a/scripts/run-mcp-tool.sh b/scripts/run-mcp-tool.sh index 94ccbe6..11d3d0b 100755 --- a/scripts/run-mcp-tool.sh +++ b/scripts/run-mcp-tool.sh @@ -44,6 +44,15 @@ load_env() { } run() { + if [[ -z "$tool_data" ]]; then + die "error: no JSON data" + fi + + if [[ "$OS" == "Windows_NT" ]]; then + set -o igncr + tool_data="$(echo "$tool_data" | sed 's/\\/\\\\/g')" + fi + no_llm_output=0 if [[ -z "$LLM_OUTPUT" ]]; then no_llm_output=1 diff --git a/scripts/run-tool.sh b/scripts/run-tool.sh index c764626..1662a26 100755 --- a/scripts/run-tool.sh +++ b/scripts/run-tool.sh @@ -58,6 +58,7 @@ run() { if [[ "$OS" == "Windows_NT" ]]; then set -o igncr tool_path="$(cygpath -w "$tool_path")" + tool_data="$(echo "$tool_data" | sed 's/\\/\\\\/g')" fi jq_script="$(cat <<-'EOF'