agentscope-ai / agentscope-ai/agentscope-java

[Bug]:创建k8s沙箱的时候报错,无法新建工作目录

Abierto
#2,396 4 comentarios 0 reacciones 0 asignados Ver en GitHub
area/extensions bug
Lenguaje dominante
Java
Estrellas
5.6k
Forks
1.3k
Merge medio
4 d 12 h
PR fusionados (30 d)
77

Descripción

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会报错,导致创建沙箱失败

Guía de contribución

Abrir la guía de contribución

Evaluación

Este issue todavía no se ha evaluado.

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.