修复 多余的命令执行错误

This commit is contained in:
Suwings 2022-02-23 18:30:43 +08:00
parent 7c85797547
commit 1f3b1a43a5

View File

@ -35,12 +35,7 @@ export default class DockerResizeCommand extends InstanceCommand {
} }
async exec(instance: Instance, size?: IResizeOptions): Promise<any> { async exec(instance: Instance, size?: IResizeOptions): Promise<any> {
if (!instance.process) { if (!instance.process || !(instance.config.processType === "docker")) return;
instance.failure(new Error("命令执行失败,因为实例实际进程不存在."));
}
if (!(instance.config.processType === "docker")) {
instance.failure(new Error("重设TTY大小失败因为实例不是Docker容器."));
}
const dockerProcess = <DockerProcessAdapter>instance.process; const dockerProcess = <DockerProcessAdapter>instance.process;
await dockerProcess.container.resize({ await dockerProcess.container.resize({
h: size.h, h: size.h,