]> git.djapps.eu Git - pkg/ggml/sources/llama.cpp/commitdiff
server: report the isolate working directory from get_info (#26773)
authorPascal <redacted>
Sat, 8 Aug 2026 22:42:50 +0000 (00:42 +0200)
committerGitHub <redacted>
Sat, 8 Aug 2026 22:42:50 +0000 (00:42 +0200)
* server: report the isolate working directory from get_info

Without an explicit cwd, get_info fell back to the server process
working directory even when a tools runtime was configured. That named a
host path no tool would ever run in, since an isolate starts in a
directory of its own.

It now asks the isolate for its working directory in that case, and
keeps the process one only when the tools run on the host.

* remove redundant comment

---------

Co-authored-by: Xuan-Son Nguyen <redacted>
tools/server/server-tools.cpp

index d5e696434ca716aaeb668757343eb622702297f8..27c663fdd25629c32dac53e62039b6122e3b9da4 100644 (file)
@@ -1669,8 +1669,13 @@ struct server_tool_get_info : server_tool {
 
         std::string cwd = json_value(params, "cwd", std::string());
         if (cwd.empty()) {
-            std::error_code ec;
-            cwd = path_to_utf8(fs::current_path(ec));
+            if (json_value(params, "runtime", std::string()).empty()) {
+                std::error_code ec;
+                cwd = path_to_utf8(fs::current_path(ec));
+            } else {
+                auto pwd = io->run({"pwd"}, SERVER_TOOL_GET_INFO_MAX_OUTPUT, SERVER_TOOL_GET_INFO_TIMEOUT);
+                cwd = pwd.exit_code == 0 && !pwd.timed_out ? string_strip(pwd.output) : "unknown";
+            }
         }
 
         return {