forked from mirror/MCSM-Daemon
Feat: docker empty command start method
This commit is contained in:
parent
8ea9dfc304
commit
32cdbace6c
@ -48,7 +48,7 @@ export function commandStringToArray(cmd: string) {
|
||||
_analyze();
|
||||
|
||||
if (cmdArray.length == 0) {
|
||||
throw new Error($t("command.errLen"));
|
||||
return [];
|
||||
}
|
||||
|
||||
for (const index in cmdArray) {
|
||||
|
@ -92,7 +92,7 @@ export default class DockerStartCommand extends InstanceCommand {
|
||||
}
|
||||
|
||||
async exec(instance: Instance, source = "Unknown") {
|
||||
if (!instance.config.startCommand || !instance.config.cwd || !instance.config.ie || !instance.config.oe)
|
||||
if (!instance.config.cwd || !instance.config.ie || !instance.config.oe)
|
||||
return instance.failure(new StartupDockerProcessError($t("instance.dirEmpty")));
|
||||
if (!fs.existsSync(instance.absoluteCwdPath())) return instance.failure(new StartupDockerProcessError($t("instance.dirNoE")));
|
||||
|
||||
|
@ -62,7 +62,12 @@ export default class GeneralStartCommand extends InstanceCommand {
|
||||
}
|
||||
|
||||
async exec(instance: Instance, source = "Unknown") {
|
||||
if (!instance.config.startCommand || !instance.config.cwd || !instance.config.ie || !instance.config.oe)
|
||||
if (
|
||||
(!instance.config.startCommand && instance.config.processType === "general") ||
|
||||
!instance.config.cwd ||
|
||||
!instance.config.ie ||
|
||||
!instance.config.oe
|
||||
)
|
||||
return instance.failure(new StartupError($t("general_start.instanceConfigErr")));
|
||||
if (!fs.existsSync(instance.absoluteCwdPath())) return instance.failure(new StartupError($t("general_start.cwdPathNotExist")));
|
||||
|
||||
|
@ -8,6 +8,8 @@ interface IActionCommand {
|
||||
command: string;
|
||||
}
|
||||
|
||||
type ProcessType = "general" | "docker";
|
||||
|
||||
// @Entity
|
||||
export default class InstanceConfig {
|
||||
public nickname = "Undefined";
|
||||
@ -22,7 +24,7 @@ export default class InstanceConfig {
|
||||
public tag: string[] = [];
|
||||
public endTime: string = "";
|
||||
public fileCode: string = "utf-8";
|
||||
public processType: string = "general";
|
||||
public processType: ProcessType = "general";
|
||||
public updateCommand: string = "";
|
||||
public crlf = os.platform() === "win32" ? 2 : 1; // 1: \n 2: \r\n
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user