Skip to content

Commit

Permalink
fix: stream stdio from Docker commands in script
Browse files Browse the repository at this point in the history
  • Loading branch information
turadg committed Nov 6, 2023
1 parent ca3070f commit 890b2e2
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 8 deletions.
6 changes: 2 additions & 4 deletions buildTestImages.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#!/usr/bin/env tsx
// @ts-check

import { parseArgs } from 'node:util';
import { execSync } from 'node:child_process';
Expand All @@ -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;
Expand All @@ -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' });
}
}
6 changes: 2 additions & 4 deletions runTestImages.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
#!/usr/bin/env tsx
// @ts-check

import { parseArgs } from 'node:util';
import { execSync } from 'node:child_process';
import { imageNameForProposalTest, readProposals } from './common';

const options = {
match: { short: 'm', type: 'string' },
};
} as const;
const { values } = parseArgs({ options });

const { match } = values;
Expand All @@ -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' });
}

0 comments on commit 890b2e2

Please sign in to comment.