From 3993858520365dc679790a9d0f1f3b1d36066fd4 Mon Sep 17 00:00:00 2001 From: marcosduma Date: Sat, 2 Dec 2023 09:35:59 -0300 Subject: [PATCH] Multiple terminals --- src/mi2.ts | 17 ++++++----------- 1 file changed, 6 insertions(+), 11 deletions(-) diff --git a/src/mi2.ts b/src/mi2.ts index e0f509f..4b90fb1 100644 --- a/src/mi2.ts +++ b/src/mi2.ts @@ -1114,17 +1114,12 @@ export class MI2 extends EventEmitter implements IDebugger { return strCode; } - isTerminalInstalled(terminalCommand):boolean { + isTerminalInstalled(terminalCommand: string): boolean { try { - const command = `command -v ${terminalCommand} >/dev/null 2>/dev/null`; - const xterm_process = ChildProcess.spawn(command, { - detached: true, - stdio: 'ignore', - }); - xterm_process.unref(); - return true; + ChildProcess.execSync(`command -v ${terminalCommand}`); + return true; } catch (error) { - return false; + return false; } } @@ -1220,10 +1215,10 @@ export class MI2 extends EventEmitter implements IDebugger { this.createXtermTerminal(sleepVal, target); }else if(this.isTerminalInstalled("gnome-terminal")){ this.createGNOMETerminal(sleepVal, target); - }else if(this.isTerminalInstalled("konsole")){ - this.createKDETerminal(sleepVal, target); }else if(this.isTerminalInstalled("xfce4-terminal")){ this.createXFCETerminal(sleepVal, target); + }else if(this.isTerminalInstalled("konsole")){ + this.createKDETerminal(sleepVal, target); } } } else {