agentscope-ai / agentscope-ai/agentscope-java
[Bug]:创建k8s沙箱的时候报错,无法新建工作目录
- Linguagem predominante
- Java
- Estrelas
- 5.6k
- Forks
- 1.3k
- Merge médio
- 4d 12h
- PRs com merge (30d)
- 77
Descrição
public ExecResult exec(KubernetesSandboxState state, String command, int timeoutSeconds)
throws Exception {
String script =
"cd " + shellSingleQuote(state.getWorkspaceRoot()) + " && (" + command + ")";
ByteArrayOutputStream out = new ByteArrayOutputStream();
ByteArrayOutputStream err = new ByteArrayOutputStream();
ContainerResource pod = pod(state);
try (ExecWatch watch = pod.writingOutput(out).writingError(err).exec("sh", "-c", script)) {
Integer exit = watch.exitCode().get(timeoutSeconds + 5L, TimeUnit.SECONDS);
int code = exit != null ? exit : -1;
String stdout = truncate(out.toByteArray());
String stderr = truncate(err.toByteArray());
boolean truncated =
out.size() >= OUTPUT_TRUNCATE_BYTES || err.size() >= OUTPUT_TRUNCATE_BYTES;
ExecResult result = new ExecResult(code, stdout, stderr, truncated);
if (!result.ok()) {
throw new SandboxException.ExecException(code, stdout, stderr);
}
return result;
} catch (java.util.concurrent.TimeoutException e) {
throw new SandboxException.ExecTimeoutException(command, timeoutSeconds);
}
}
这个代码中命令是cd workspace && mkdir -p workspace,但是workspace 不存在,cd workspace会报错,导致创建沙箱失败
Guia de contribuição
Avaliação
Esta issue ainda não foi avaliada.