Stop splitting string commands on spaces in `exec`
Les mainteneurs répondent en général sous 4 jours
@Mario-Mohar y travaille déjà.
Depuis le 30/10/2026.
Évaluation
- Difficulté
- 4/5
- Temps estimé
- 3-5 jours
- Accessibilité débutants
- 55/100
- Type d'issue
- Bug
- Clarté
- Clairement spécifiée
- Activité
- Active
- Stack technique
- docker, node.js, typescript
Piste de recherche
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.
Rédigé par le modèle d'indexation à partir du texte de l'issue.
Description
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.
- Langage dominant
- TypeScript
- Étoiles
- 2.7k
- Forks
- 290
- Merge moyen
- 4 j 1 h
- PR mergées (30 j)
- 22
Préparer son environnement
Lance le conteneur de développement du projet dans votre navigateur, avec votre propre compte GitHub.
- Fournit un Dockerfile ou un fichier Docker Compose
- Aucun modèle de pull request
- Lire le guide de contribution
Par où commencer
- Lisez l'issue en entier, puis le guide de contribution du projet.
- Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
- Forkez le dépôt et travaillez sur une branche.
- Ouvrez une pull request qui référence le numéro de l'issue.
Autres issues de testcontainers/testcontainers-node
-
Difficulté 2/5 1-3 heures Accessibilité débutants 72/100
testcontainers/testcontainers-node#1673 ·
Les mainteneurs répondent en général sous 4 jours
-
enhancement minor
Difficulté 2/5 1-3 heures Accessibilité débutants 74/100
testcontainers/testcontainers-node#1539 ·
Les mainteneurs répondent en général sous 4 jours
-
Let `Wait.forListeningPorts()` wait on specific portsPeut-être pris @artbom l’a pris il y a 29 jours. Ouverteenhancement minor
Difficulté 2/5 1-3 heures Accessibilité débutants 82/100
testcontainers/testcontainers-node#1533 ·
Les mainteneurs répondent en général sous 4 jours
-
enhancement minor
Difficulté 2/5 1-3 heures Accessibilité débutants 77/100
testcontainers/testcontainers-node#1531 ·
Les mainteneurs répondent en général sous 4 jours
-
Export the types used in public method signaturesPeut-être pris @artbom l’a pris il y a 29 jours. Ouverteenhancement minor
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
testcontainers/testcontainers-node#1528 ·
Les mainteneurs répondent en général sous 4 jours
Toutes les issues de testcontainers/testcontainers-node
Issues similaires
-
prio:low scope:hud
Difficulté 2/5 1-3 heures Accessibilité débutants 78/100
OliverRomhagen/vrigstad-joyride#953 ·
Les mainteneurs répondent en général sous 1 jour
-
review-followup
Difficulté 1/5 Moins d'une heure Accessibilité débutants 92/100
griffinwork40/agent-afk#5446 ·
Les mainteneurs répondent en général sous 1 jour
-
enhancement
Difficulté 2/5 1-3 heures Accessibilité débutants 65/100
kacper-szewczyk/Ticknest#346 ·
Les mainteneurs répondent en général sous 1 jour
-
echarts geo: a GeoJSON URL that returns 200 with a body that is not JSON is fetched on each refreshOuvertebug plugin/echarts/geo
Difficulté 2/5 1-3 heures Accessibilité débutants 86/100
Les mainteneurs répondent en général sous 1 jour
-
Difficulté 2/5 1-3 heures Accessibilité débutants 79/100
Yeachan-Heo/gajae-code#8230 ·
Les mainteneurs répondent en général sous 1 jour