Skip to content

Commit

Permalink
Improve handling of stack status, close #11
Browse files Browse the repository at this point in the history
  • Loading branch information
louislam committed Nov 19, 2023
1 parent 0208684 commit c8770a9
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions backend/stack.ts
Original file line number Diff line number Diff line change
Expand Up @@ -264,15 +264,18 @@ export class Stack {

/**
* Convert the status string from `docker compose ls` to the status number
* Input Example: "exited(1), running(1)"
* @param status
*/
static statusConvert(status : string) : number {
if (status.startsWith("created")) {
return CREATED_STACK;
} else if (status.includes("exited")) {
// If one of the service is exited, we consider the stack is exited
return EXITED;
} else if (status.startsWith("running")) {
// If there is no exited services, there should be only running services
return RUNNING;
} else if (status.startsWith("exited")) {
return EXITED;
} else {
return UNKNOWN;
}
Expand Down

0 comments on commit c8770a9

Please sign in to comment.