Skip to content

Commit a416c5d

Browse files
author
Alan Shaw
authored
chore: inherit stdio (#1862)
Makes the console a bit more noisy but it is super helpful for when the process hangs. These were hanging for me - I added this and it turns out docker was just taking ages to download images. I didn't know that was happening so I didn't wait around for it to finish.
1 parent 7515e39 commit a416c5d

2 files changed

Lines changed: 48 additions & 44 deletions

File tree

packages/api/pw-test.config.cjs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,12 @@ module.exports = {
5050
beforeTests: async () => {
5151
const mock = await startMockServer('AWS S3', 9095, 'test/mocks/aws-s3')
5252

53-
await execa(cli, ['db', '--start'])
53+
await execa(cli, ['db', '--start'], { stdio: 'inherit' })
5454
console.log('⚡️ Cluster and Postgres started.')
5555

56-
await execa(cli, ['db-sql', '--cargo', '--testing', '--reset'])
56+
await execa(cli, ['db-sql', '--cargo', '--testing', '--reset'], {
57+
stdio: 'inherit',
58+
})
5759
console.log('⚡️ SQL schema loaded.')
5860

5961
await delay(2000)

packages/api/scripts/cmds/db.js

Lines changed: 44 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -49,60 +49,62 @@ export async function dbCmd(opts) {
4949
const composePath = path.join(__dirname, '../../docker/docker-compose.yml')
5050

5151
if (opts.init) {
52-
await execa('docker-compose', [
53-
'--file',
54-
composePath,
55-
'build',
56-
'--no-cache',
57-
])
52+
await execa(
53+
'docker-compose',
54+
['--file', composePath, 'build', '--no-cache'],
55+
{ stdio: 'inherit' }
56+
)
5857

59-
await execa('docker-compose', [
60-
'--file',
61-
composePath,
62-
'--project-name',
63-
opts.project,
64-
'up',
65-
'--build',
66-
'--no-start',
67-
'--renew-anon-volumes',
68-
])
58+
await execa(
59+
'docker-compose',
60+
[
61+
'--file',
62+
composePath,
63+
'--project-name',
64+
opts.project,
65+
'up',
66+
'--build',
67+
'--no-start',
68+
'--renew-anon-volumes',
69+
],
70+
{ stdio: 'inherit' }
71+
)
6972
}
7073

7174
if (opts.start) {
7275
if ((await isPortReachable(5432)) || (await isPortReachable(3000))) {
7376
console.error('⚠️ Docker project is already running.')
7477
}
75-
await execa('docker-compose', [
76-
'--file',
77-
composePath,
78-
'--project-name',
79-
opts.project,
80-
'up',
81-
'--detach',
82-
])
78+
await execa(
79+
'docker-compose',
80+
['--file', composePath, '--project-name', opts.project, 'up', '--detach'],
81+
{ stdio: 'inherit' }
82+
)
8383
}
8484

8585
if (opts.stop) {
86-
await execa('docker-compose', [
87-
'--file',
88-
composePath,
89-
'--project-name',
90-
opts.project,
91-
'stop',
92-
])
86+
await execa(
87+
'docker-compose',
88+
['--file', composePath, '--project-name', opts.project, 'stop'],
89+
{ stdio: 'inherit' }
90+
)
9391
}
9492

9593
if (opts.clean) {
96-
await execa('docker-compose', [
97-
'--file',
98-
composePath,
99-
'--project-name',
100-
opts.project,
101-
'down',
102-
'--rmi',
103-
'local',
104-
'-v',
105-
'--remove-orphans',
106-
])
94+
await execa(
95+
'docker-compose',
96+
[
97+
'--file',
98+
composePath,
99+
'--project-name',
100+
opts.project,
101+
'down',
102+
'--rmi',
103+
'local',
104+
'-v',
105+
'--remove-orphans',
106+
],
107+
{ stdio: 'inherit' }
108+
)
107109
}
108110
}

0 commit comments

Comments
 (0)