Skip to content

Commit 7ba604f

Browse files
server: report the isolate working directory from get_info (ggml-org#26773)
* 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 <thichthat@gmail.com>
1 parent 687e778 commit 7ba604f

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

tools/server/server-tools.cpp

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1669,8 +1669,13 @@ struct server_tool_get_info : server_tool {
16691669

16701670
std::string cwd = json_value(params, "cwd", std::string());
16711671
if (cwd.empty()) {
1672-
std::error_code ec;
1673-
cwd = path_to_utf8(fs::current_path(ec));
1672+
if (json_value(params, "runtime", std::string()).empty()) {
1673+
std::error_code ec;
1674+
cwd = path_to_utf8(fs::current_path(ec));
1675+
} else {
1676+
auto pwd = io->run({"pwd"}, SERVER_TOOL_GET_INFO_MAX_OUTPUT, SERVER_TOOL_GET_INFO_TIMEOUT);
1677+
cwd = pwd.exit_code == 0 && !pwd.timed_out ? string_strip(pwd.output) : "unknown";
1678+
}
16741679
}
16751680

16761681
return {

0 commit comments

Comments
 (0)