mirror of
https://github.com/MCSManager/MCSManager.git
synced 2024-12-15 07:40:01 +08:00
Fix: Docker Stop Err
This commit is contained in:
parent
90cced1475
commit
16a6235041
@ -74,7 +74,9 @@ export class DockerProcessAdapter extends EventEmitter implements IInstanceProce
|
||||
}
|
||||
|
||||
public async destroy() {
|
||||
try {
|
||||
await this.container.remove();
|
||||
} catch (error) {}
|
||||
}
|
||||
|
||||
private wait() {
|
||||
|
@ -174,17 +174,16 @@ class InstanceSubsystem extends EventEmitter {
|
||||
removeInstance(instanceUuid: string, deleteFile: boolean) {
|
||||
const instance = this.getInstance(instanceUuid);
|
||||
if (instance) {
|
||||
if (instance.status() !== Instance.STATUS_STOP)
|
||||
throw new Error($t("请确保实例处于停止状态再删除!"));
|
||||
instance.destroy();
|
||||
// destroy record
|
||||
this.instances.delete(instanceUuid);
|
||||
StorageSubsystem.delete("InstanceConfig", instanceUuid);
|
||||
// delete scheduled task
|
||||
InstanceControl.deleteInstanceAllTask(instanceUuid);
|
||||
// delete the file asynchronously
|
||||
if (deleteFile) fs.remove(instance.config.cwd, (err) => {});
|
||||
return true;
|
||||
}
|
||||
throw new Error("Instance does not exist");
|
||||
throw new Error($t("目标实例不存在!"));
|
||||
}
|
||||
|
||||
forward(targetInstanceUuid: string, socket: Socket) {
|
||||
|
Loading…
Reference in New Issue
Block a user