Skip to content

Commit da5a772

Browse files
fix: handle spacing in env variables of commands (#202)
1 parent 652c2ef commit da5a772

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/SandboxClient/commands.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,10 @@ export class SandboxCommands {
133133
? `source $HOME/.private/.env 2>/dev/null || true && env ${Object.entries(
134134
passedEnv
135135
)
136-
.map(([key, value]) => `${key}=${value}`)
136+
.map(([key, value]) => {
137+
const escapedValue = String(value).replace(/'/g, "'\\''");
138+
return `${key}='${escapedValue}'`;
139+
})
137140
.join(" ")} bash -c '${escapedCommand}'`
138141
: `source $HOME/.private/.env 2>/dev/null || true && bash -c '${escapedCommand}'`;
139142

0 commit comments

Comments
 (0)