mirror of
https://github.com/fabro-sh/fabro.git
synced 2026-09-11 22:53:00 +00:00
Restore Daytona env export workaround alongside SDK fix
The Daytona toolbox's /process/execute endpoint does not yet process the envs field (not in its OpenAPI spec), so prepend export statements as a fallback. The SDK also sends envs for forward compatibility. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
8dffe80527
commit
23cff7db70
1 changed files with 22 additions and 1 deletions
|
|
@ -896,9 +896,30 @@ impl Sandbox for DaytonaSandbox {
|
|||
timeout: Some(std::time::Duration::from_millis(timeout_ms)),
|
||||
};
|
||||
|
||||
// The Daytona toolbox's /process/execute endpoint does not yet
|
||||
// process the `envs` field (not in its OpenAPI spec), so we also
|
||||
// prepend `export` statements as a fallback until server support
|
||||
// lands. The SDK sends `envs` too for forward compatibility.
|
||||
let command_with_env = if let Some(vars) = env_vars {
|
||||
if !vars.is_empty() {
|
||||
let exports: Vec<String> = vars
|
||||
.iter()
|
||||
.map(|(k, v)| {
|
||||
let escaped = v.replace('\'', "'\\''");
|
||||
format!("export {k}='{escaped}'")
|
||||
})
|
||||
.collect();
|
||||
format!("{}\n{}", exports.join("\n"), command)
|
||||
} else {
|
||||
command.to_string()
|
||||
}
|
||||
} else {
|
||||
command.to_string()
|
||||
};
|
||||
|
||||
// Wrap with `bash -c` so pipes, env vars, and shell features work.
|
||||
// The Daytona API uses direct exec, not a shell.
|
||||
let wrapped = wrap_bash_command(command);
|
||||
let wrapped = wrap_bash_command(&command_with_env);
|
||||
let result = process_svc
|
||||
.execute_command(&wrapped, options)
|
||||
.await
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue