Stop splitting string commands on spaces in `exec`
I maintainer di solito rispondono entro 4 giorni
@Mario-Mohar ci sta già lavorando.
Dal 30/10/2026.
Valutazione
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Idoneità per principianti
- 55/100
- Tipo di issue
- Bug
- Chiarezza
- Specificata chiaramente
- Stato di attività
- Attiva
- Stack tecnologico
- docker, node.js, typescript
Direzione di ricerca
Start at exec in packages/testcontainers/src/generic/started-generic.ts and compare how its string and array forms build arguments. Then inspect the Redis and Valkey call sites named in the issue, and coordinate the string overload deprecation with #1518. Done means commands with spaces are passed as intended, both module calls use the array form, and the relevant tests cover the behavior.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Descrizione
What happens
exec accepts string | string[]. The string form is turned into arguments with command.split(" "), so quoting is not honoured and any argument containing a space is broken up.
await container.exec('sh -c "echo hello world"');
// exitCode: 2
// stderr: hello: line 1: syntax error: unterminated quoted string
await container.exec(["sh", "-c", "echo hello world"]);
// exitCode: 0
// stdout: hello world
Two modules use the string form with an interpolated value:
packages/modules/redis/src/redis-container.ts:container.exec(`/tmp/import.sh ${this.password}`)packages/modules/valkey/src/valkey-container.ts:container.exec(`/tmp/import.sh ${this.password || ""}`)
A password containing a space is split into separate arguments (from reading the code).
Expected
A command is never split on spaces. Either the string form goes away, or it is parsed with shell quoting rules.
Where
exec in packages/testcontainers/src/generic-container/started-generic-container.ts.
Notes
- Java (
execInContainer(String... command)) and Go (Exec(ctx, cmd []string, ...)) accept only an argument list. - The docs only show the array form.
- Switch the redis and valkey calls to the array form either way.
- Semver: labelled
minorfor deprecating the string overload, with removal in a later major. - Reproduced on
main(aa60a746, 12.2.0) with Docker 29.6.1.
Dependencies
- Nothing blocks this. It can start now.
- Coordinate with #1518: for how the string overload is deprecated.
- Lingua principale
- TypeScript
- Stelle
- 2.7k
- Fork
- 290
- Merge medio
- 4g 1h
- PR unite (30g)
- 22
Preparare l'ambiente
Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.
- Include un Dockerfile o un file Docker Compose
- Nessun modello di pull request
- Leggi la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Altre issue di testcontainers/testcontainers-node
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 72/100
testcontainers/testcontainers-node#1673 ·
I maintainer di solito rispondono entro 4 giorni
-
enhancement minor
Difficoltà 2/5 1-3 ore Idoneità per principianti 74/100
testcontainers/testcontainers-node#1539 ·
I maintainer di solito rispondono entro 4 giorni
-
Let `Wait.forListeningPorts()` wait on specific portsForse già presa @artbom l’ha presa 29 giorni fa. Apertaenhancement minor
Difficoltà 2/5 1-3 ore Idoneità per principianti 82/100
testcontainers/testcontainers-node#1533 ·
I maintainer di solito rispondono entro 4 giorni
-
enhancement minor
Difficoltà 2/5 1-3 ore Idoneità per principianti 77/100
testcontainers/testcontainers-node#1531 ·
I maintainer di solito rispondono entro 4 giorni
-
Export the types used in public method signaturesForse già presa @artbom l’ha presa 29 giorni fa. Apertaenhancement minor
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
testcontainers/testcontainers-node#1528 ·
I maintainer di solito rispondono entro 4 giorni
Tutte le issue di testcontainers/testcontainers-node
Issue simili
-
prio:low scope:hud
Difficoltà 2/5 1-3 ore Idoneità per principianti 78/100
OliverRomhagen/vrigstad-joyride#953 ·
I maintainer di solito rispondono entro 1 giorno
-
review-followup
Difficoltà 1/5 Meno di un'ora Idoneità per principianti 92/100
griffinwork40/agent-afk#5446 ·
I maintainer di solito rispondono entro 1 giorno
-
enhancement
Difficoltà 2/5 1-3 ore Idoneità per principianti 65/100
kacper-szewczyk/Ticknest#346 ·
I maintainer di solito rispondono entro 1 giorno
-
echarts geo: a GeoJSON URL that returns 200 with a body that is not JSON is fetched on each refreshApertabug plugin/echarts/geo
Difficoltà 2/5 1-3 ore Idoneità per principianti 86/100
I maintainer di solito rispondono entro 1 giorno
-
Difficoltà 2/5 1-3 ore Idoneità per principianti 79/100
Yeachan-Heo/gajae-code#8230 ·
I maintainer di solito rispondono entro 1 giorno