mirror of
https://github.com/louislam/dockge.git
synced 2024-11-23 19:34:04 +00:00
Avoid multiple commands at the same for a stack
This commit is contained in:
parent
16cdaa8ed5
commit
69e0f77830
1 changed files with 12 additions and 8 deletions
|
@ -5,8 +5,6 @@ import { LimitQueue } from "./utils/limit-queue";
|
|||
import { DockgeSocket } from "./util-server";
|
||||
import {
|
||||
allowedCommandList, allowedRawKeys,
|
||||
getComposeTerminalName,
|
||||
getCryptoRandomInt,
|
||||
PROGRESS_TERMINAL_ROWS,
|
||||
TERMINAL_COLS,
|
||||
TERMINAL_ROWS
|
||||
|
@ -207,14 +205,20 @@ export class Terminal {
|
|||
}
|
||||
|
||||
public static exec(server : DockgeServer, socket : DockgeSocket | undefined, terminalName : string, file : string, args : string | string[], cwd : string) : Promise<number> {
|
||||
const terminal = new Terminal(server, terminalName, file, args, cwd);
|
||||
terminal.rows = PROGRESS_TERMINAL_ROWS;
|
||||
return new Promise((resolve, reject) => {
|
||||
// check if terminal exists
|
||||
if (Terminal.terminalMap.has(terminalName)) {
|
||||
reject("Another operation is already running, please try again later.");
|
||||
return;
|
||||
}
|
||||
|
||||
if (socket) {
|
||||
terminal.join(socket);
|
||||
}
|
||||
let terminal = new Terminal(server, terminalName, file, args, cwd);
|
||||
terminal.rows = PROGRESS_TERMINAL_ROWS;
|
||||
|
||||
if (socket) {
|
||||
terminal.join(socket);
|
||||
}
|
||||
|
||||
return new Promise((resolve) => {
|
||||
terminal.onExit((exitCode : number) => {
|
||||
resolve(exitCode);
|
||||
});
|
||||
|
|
Loading…
Reference in a new issue