| 52 | |
| 53 | /** Returns the names of running containers matching a substring */ |
| 54 | export function getRunningContainers(nameFilter: string): string[] { |
| 55 | const r = spawnSync( |
| 56 | 'docker', |
| 57 | ['ps', '--filter', `name=${nameFilter}`, '--format', '{{.Names}}'], |
| 58 | { encoding: 'utf-8' }, |
| 59 | ) |
| 60 | return r.status === 0 ? r.stdout.trim().split('\n').filter(Boolean) : [] |
| 61 | } |
| 62 | |
| 63 | /** Run a command inside a compose service and return stdout */ |
| 64 | export function composeExec(cwd: string, service: string, cmd: string): string { |