Skip to content
This repository was archived by the owner on Nov 28, 2022. It is now read-only.

Commit 0f44326

Browse files
author
Tim Etchells
authored
Allow stopping local CW if docker is not running (#587)
Fixes eclipse-archived/codewind#2840 Signed-off-by: Tim Etchells <timetchells@ibm.com>
1 parent 504d323 commit 0f44326

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

dev/src/codewind/cli/CLILifecycleWrapper.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,7 +279,18 @@ export namespace CLILifecycleWrapper {
279279
}
280280

281281
export async function stop(): Promise<void> {
282-
return runLifecycleCmd(CLILifecycleCommands.STOP);
282+
const status = await CLICommandRunner.status();
283+
const isStarted = status.isDockerRunning && status.started.length > 0;
284+
if (isStarted) {
285+
await runLifecycleCmd(CLILifecycleCommands.STOP);
286+
}
287+
else {
288+
const stoppedState = CLILifecycleCommands.STOP.transitionStates?.after;
289+
if (stoppedState) {
290+
LocalCodewindManager.instance.setState(stoppedState);
291+
}
292+
}
293+
// else, it's already stopped so nothing to do
283294
}
284295

285296
export async function removeAllImages(): Promise<void> {

0 commit comments

Comments
 (0)