From 1f393ac65fcb14a8dde3119eb4fa6fcfcf76ff34 Mon Sep 17 00:00:00 2001 From: Noah Allen Date: Fri, 5 May 2023 13:23:14 -0700 Subject: [PATCH 1/2] Fix docker-compose options for the phpunit and composer environments --- packages/env/lib/commands/run.js | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/packages/env/lib/commands/run.js b/packages/env/lib/commands/run.js index 1e13f7a797c38..0eaac3780dba7 100644 --- a/packages/env/lib/commands/run.js +++ b/packages/env/lib/commands/run.js @@ -61,21 +61,27 @@ function spawnCommandDirectly( config, container, command, envCwd, spinner ) { const hostUser = getHostUser(); // We need to pass absolute paths to the container. - envCwd = path.resolve( '/var/www/html', envCwd ); + envCwd = path.resolve( + container === 'composer' ? '/app' : '/var/www/html', + envCwd + ); + const useRun = container === 'phpunit' || container === 'composer'; const isTTY = process.stdout.isTTY; + const composeCommand = [ '-f', config.dockerComposeConfigPath, - 'exec', + useRun ? 'run' : 'exec', ! isTTY ? '--no-TTY' : '', '-w', envCwd, + useRun ? '--rm' : '', '--user', hostUser.fullUser, container, ...command.split( ' ' ), // The command will fail if passed as a complete string. - ]; + ].filter( Boolean ); return new Promise( ( resolve, reject ) => { // Note: since the npm docker-compose package uses the -T option, we From 0b516e322c79677615e8831afd4d776b38b231d1 Mon Sep 17 00:00:00 2001 From: Noah Allen Date: Fri, 5 May 2023 13:29:48 -0700 Subject: [PATCH 2/2] Remove boolean filter --- packages/env/lib/commands/run.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/packages/env/lib/commands/run.js b/packages/env/lib/commands/run.js index 0eaac3780dba7..b5711f2d4ddb5 100644 --- a/packages/env/lib/commands/run.js +++ b/packages/env/lib/commands/run.js @@ -81,7 +81,7 @@ function spawnCommandDirectly( config, container, command, envCwd, spinner ) { hostUser.fullUser, container, ...command.split( ' ' ), // The command will fail if passed as a complete string. - ].filter( Boolean ); + ]; return new Promise( ( resolve, reject ) => { // Note: since the npm docker-compose package uses the -T option, we