Skip to content

Commit c603c9f

Browse files
committed
fix(cli): remove shell-specific cleanup commands
1 parent 4c12914 commit c603c9f

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

packages/cli/src/index.ts

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,18 @@ program
2424
.option('-y, --yes', 'Skip interactive prompts and use defaults')
2525
.option('--no-pull', 'Skip pulling the latest Docker images')
2626

27+
async function runCommandQuiet(command: string[]): Promise<boolean> {
28+
return new Promise((resolve) => {
29+
const process = spawn(command[0], command.slice(1), { stdio: 'ignore' })
30+
process.on('error', () => {
31+
resolve(false)
32+
})
33+
process.on('close', (code) => {
34+
resolve(code === 0)
35+
})
36+
})
37+
}
38+
2739
function isDockerRunning(): Promise<boolean> {
2840
return new Promise((resolve) => {
2941
const docker = spawn('docker', ['info'])
@@ -66,12 +78,8 @@ async function pullImage(image: string): Promise<boolean> {
6678
}
6779

6880
async function stopAndRemoveContainer(name: string): Promise<void> {
69-
try {
70-
execSync(`docker stop ${name} 2>/dev/null || true`)
71-
execSync(`docker rm ${name} 2>/dev/null || true`)
72-
} catch (_error) {
73-
// Ignore errors, container might not exist
74-
}
81+
await runCommandQuiet(['docker', 'stop', name])
82+
await runCommandQuiet(['docker', 'rm', name])
7583
}
7684

7785
async function cleanupExistingContainers(): Promise<void> {

0 commit comments

Comments
 (0)