print output from create and update testserver commands while command

runs
This commit is contained in:
Arwid Thornström
2025-08-13 09:01:27 +02:00
parent 7167261aaa
commit dd265d28f3
2 changed files with 55 additions and 8 deletions
@@ -10,6 +10,7 @@ import {
getSettings,
sleep,
} from '../../../../globals';
const { spawn } = require('child_process');
type Stack = {
name: string;
@@ -126,11 +127,33 @@ module.exports = {
cmd,
)}] in folder [${`${config.photowall_repo}/cloudformation/`}]`,
);
const output = await system.run(cmd, {
cwd: `${config.photowall_repo}/cloudformation/`,
trim: true,
const child = spawn(
'make',
[
'update-stack',
`STACK_ENVIRONMENT_NAME=${stacksuffix}`,
`GITHUB_BRANCH=${branchName}`,
],
{
cwd: `${config.photowall_repo}/cloudformation/`,
},
);
child.stdout.setEncoding('utf8');
child.stdout.on('data', (data) => {
process.stdout.write(data);
});
child.stderr.on('data', (data) => {
process.stderr.write(data);
});
await new Promise((resolve, reject) => {
child.on('close', (code) => {
if (code === 0) {
resolve(0);
} else {
reject(new Error(`make exited with code ${code}`));
}
});
});
print.fancy(output);
// Check the status
const spinner = print.spin(`Waiting for stack to update`);