Skip to content

Commit 3e2fa2e

Browse files
committed
Fix running Docker when not in TTY
1 parent bcbf5da commit 3e2fa2e

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

tools/local-env/scripts/docker.js

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,12 @@ if ( process.argv.includes( '--coverage-html' ) ) {
1414
process.env.LOCAL_PHP_XDEBUG_MODE = 'coverage';
1515
}
1616

17+
// Add --no-TTY (-T) arg after exec and run commands when STDIN is not a TTY.
18+
const dockerCommand = process.argv.slice( 2 );
19+
if ( [ 'exec', 'run' ].includes( dockerCommand[0] ) && ! process.stdin.isTTY ) {
20+
dockerCommand.splice( 1, 0, '--no-TTY' );
21+
}
22+
1723
// Execute any Docker compose command passed to this script.
1824
const returns = spawnSync(
1925
'docker',
@@ -22,7 +28,7 @@ const returns = spawnSync(
2228
...composeFiles
2329
.map( ( composeFile ) => [ '-f', composeFile ] )
2430
.flat(),
25-
...process.argv.slice( 2 ),
31+
...dockerCommand,
2632
],
2733
{ stdio: 'inherit' }
2834
);

0 commit comments

Comments
 (0)