From 890b2e27d5128d71b2219bb15ae3e470c3e34492 Mon Sep 17 00:00:00 2001 From: Turadg Aleahmad Date: Mon, 6 Nov 2023 05:36:38 -0800 Subject: [PATCH] fix: stream stdio from Docker commands in script --- buildTestImages.ts | 6 ++---- runTestImages.ts | 6 ++---- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/buildTestImages.ts b/buildTestImages.ts index 29b07fc6..555b0a9b 100755 --- a/buildTestImages.ts +++ b/buildTestImages.ts @@ -1,5 +1,4 @@ #!/usr/bin/env tsx -// @ts-check import { parseArgs } from 'node:util'; import { execSync } from 'node:child_process'; @@ -11,7 +10,7 @@ refreshDockerfile(); const options = { match: { short: 'm', type: 'string' }, dry: { type: 'boolean' }, -}; +} as const; const { values } = parseArgs({ options }); const { match, dry } = values; @@ -30,7 +29,6 @@ for (const proposal of proposals) { const cmd = `docker build --tag ${name} --target ${target} .`; console.log(cmd); if (!dry) { - // TODO stream the output - execSync(cmd); + execSync(cmd, { stdio: 'inherit' }); } } diff --git a/runTestImages.ts b/runTestImages.ts index f1722c13..b9dd11ba 100755 --- a/runTestImages.ts +++ b/runTestImages.ts @@ -1,5 +1,4 @@ #!/usr/bin/env tsx -// @ts-check import { parseArgs } from 'node:util'; import { execSync } from 'node:child_process'; @@ -7,7 +6,7 @@ import { imageNameForProposalTest, readProposals } from './common'; const options = { match: { short: 'm', type: 'string' }, -}; +} as const; const { values } = parseArgs({ options }); const { match } = values; @@ -23,6 +22,5 @@ for (const proposal of proposals) { const { name } = imageNameForProposalTest(proposal); // 'rm' to remove the container when it exits const cmd = `docker run --rm ${name}`; - // TODO stream the output - execSync(cmd); + execSync(cmd, { stdio: 'inherit' }); }