From 8fe95aefbbb2dfd63b5811120965d1ac4ed4db15 Mon Sep 17 00:00:00 2001 From: Luc Somers Date: Thu, 15 Feb 2024 11:34:36 +0100 Subject: [PATCH] passing the whole terminal instead of id --- src/commands/generatePrototypeCommand.ts | 6 +++--- src/utils/terminalUtils.ts | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/src/commands/generatePrototypeCommand.ts b/src/commands/generatePrototypeCommand.ts index db3a29a..17e8fef 100644 --- a/src/commands/generatePrototypeCommand.ts +++ b/src/commands/generatePrototypeCommand.ts @@ -3,7 +3,7 @@ import * as vscode from 'vscode'; import * as path from 'path'; export class generatePrototypeCommand { - private static portForwardTerminalPID: Thenable | undefined; + private static portForwardTerminalPID: vscode.Terminal | undefined; static GeneratePrototypeCommand(context: vscode.ExtensionContext) { @@ -47,7 +47,7 @@ export class generatePrototypeCommand { }); }); - function tryKillPortForwardedProcessAndTerminal(terminalPID : Thenable | undefined) + function tryKillPortForwardedProcessAndTerminal(terminalPID : vscode.Terminal | undefined) { if(terminalPID === undefined) return; @@ -55,7 +55,7 @@ export class generatePrototypeCommand { let killerTerminalPID = terminalUtils.RunCommandsInNewTerminal("Kill processes", [`PID=$(ps -ef | grep 'kubectl port-forward' | grep -v grep | awk '{print $2}')`, `kill $PID`, - (`kill ` + terminalPID)]); + (`kill ` + terminalPID.processId)]); } } } \ No newline at end of file diff --git a/src/utils/terminalUtils.ts b/src/utils/terminalUtils.ts index 2a8c54e..d5b9db2 100644 --- a/src/utils/terminalUtils.ts +++ b/src/utils/terminalUtils.ts @@ -1,4 +1,4 @@ -import vscode from 'vscode'; +import vscode, { Terminal } from 'vscode'; import { fileUtils } from './fileUtils'; export class terminalUtils{ @@ -14,7 +14,7 @@ export class terminalUtils{ terminal.show(); } - static RunCommandsInNewTerminal(terminalName : string, runAmpersandCommands : string[], workingDir? : string[]) : Thenable + static RunCommandsInNewTerminal(terminalName : string, runAmpersandCommands : string[], workingDir? : string[]) : Terminal { if(workingDir === undefined) { @@ -27,6 +27,6 @@ export class terminalUtils{ terminal.sendText(command) }); - return terminal.processId; + return terminal; } } \ No newline at end of file