This commit is contained in:
Louis Lam
2023-11-10 21:52:38 +08:00
parent a12c6dc033
commit 9b9234434e
16 changed files with 241 additions and 73 deletions

View File

@@ -333,4 +333,26 @@ export class Stack {
terminal.join(socket);
terminal.start();
}
async getServiceStatusList() {
let statusList = new Map<string, number>();
let res = childProcess.execSync("docker compose ps --format json", {
cwd: this.path,
});
let lines = res.toString().split("\n");
console.log(lines);
for (let line of lines) {
try {
let obj = JSON.parse(line);
statusList.set(obj.Service, obj.State);
} catch (e) {
}
}
return statusList;
}
}