Skip to content

Commit

Permalink
adding static terminal reference
Browse files Browse the repository at this point in the history
  • Loading branch information
lucsomers101 committed Feb 19, 2024
1 parent 05f5988 commit f0d55a6
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/commands/generatePrototypeCommand.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { terminalBuilder } from "../builders/terminalBuilder";
import { manifest } from '../models/manifest';

export class generatePrototypeCommand {
private portForwardTerminal: vscode.Terminal | undefined;
static portForwardTerminal: vscode.Terminal | undefined;
private builder : terminalBuilder = new terminalBuilder();

private manifestFile : manifest;
Expand All @@ -23,15 +23,15 @@ export class generatePrototypeCommand {

private tryKillPortForwardedProcessAndTerminal()
{
if(this.portForwardTerminal === undefined)
if(generatePrototypeCommand.portForwardTerminal === undefined)
return;

const buildTerminal = this.builder.setName("default name")
.setVisibility(false)
.getTerminal();

//get the processID from the terminal that needs to be killed
this.portForwardTerminal.processId.then((terminalToKillPID: number | undefined) => {
generatePrototypeCommand.portForwardTerminal.processId.then((terminalToKillPID: number | undefined) => {
terminalUtils.RunCommandsInExistingTerminal(buildTerminal,
[`PID=$(ps -ef | grep 'kubectl port-forward' | grep -v grep | awk '{print $2}')`,
`kill $PID`,
Expand Down Expand Up @@ -63,10 +63,10 @@ export class generatePrototypeCommand {
const deployment: string = 'prototype';
const service: string = 'prototype';

this.portForwardTerminal = this.builder.setName("Run prototype in minikube")
generatePrototypeCommand.portForwardTerminal = this.builder.setName("Run prototype in minikube")
.getTerminal();

terminalUtils.RunCommandsInExistingTerminal(this.portForwardTerminal,
terminalUtils.RunCommandsInExistingTerminal(generatePrototypeCommand.portForwardTerminal,
[`kubectl apply -f ${this.manifestFile.fileUri.fsPath}`,
`kubectl rollout status deployment/${deployment} --timeout=300s`,
`kubectl port-forward svc/${service} -n default 8000:80`,]);
Expand Down

0 comments on commit f0d55a6

Please sign in to comment.