Skip to content

Commit

Permalink
passing the whole terminal instead of id
Browse files Browse the repository at this point in the history
  • Loading branch information
lucsomers101 committed Feb 15, 2024
1 parent afc1613 commit 8fe95ae
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 3 additions & 3 deletions src/commands/generatePrototypeCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ import * as vscode from 'vscode';
import * as path from 'path';

export class generatePrototypeCommand {
private static portForwardTerminalPID: Thenable<number | undefined> | undefined;
private static portForwardTerminalPID: vscode.Terminal | undefined;

static GeneratePrototypeCommand(context: vscode.ExtensionContext)
{
Expand Down Expand Up @@ -47,15 +47,15 @@ export class generatePrototypeCommand {
});
});

function tryKillPortForwardedProcessAndTerminal(terminalPID : Thenable<number | undefined> | undefined)
function tryKillPortForwardedProcessAndTerminal(terminalPID : vscode.Terminal | undefined)
{
if(terminalPID === undefined)
return;

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)]);
}
}
}
6 changes: 3 additions & 3 deletions src/utils/terminalUtils.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import vscode from 'vscode';
import vscode, { Terminal } from 'vscode';
import { fileUtils } from './fileUtils';

export class terminalUtils{
Expand All @@ -14,7 +14,7 @@ export class terminalUtils{
terminal.show();
}

static RunCommandsInNewTerminal(terminalName : string, runAmpersandCommands : string[], workingDir? : string[]) : Thenable<number | undefined>
static RunCommandsInNewTerminal(terminalName : string, runAmpersandCommands : string[], workingDir? : string[]) : Terminal
{
if(workingDir === undefined)
{
Expand All @@ -27,6 +27,6 @@ export class terminalUtils{
terminal.sendText(command)
});

return terminal.processId;
return terminal;
}
}

0 comments on commit 8fe95ae

Please sign in to comment.