Skip to content

Commit fe6c9a8

Browse files
committed
Use OpenShift Terminal for Serverless
- Also fix a race condition that caused the terminal spawn to fail Signed-off-by: David Thompson <davthomp@redhat.com>
1 parent a4f82e9 commit fe6c9a8

File tree

5 files changed

+128
-282
lines changed

5 files changed

+128
-282
lines changed

src/cli.ts

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ export interface CliExitData {
2222
export interface Cli {
2323
execute(cmd: string, opts?: cp.ExecOptions): Promise<CliExitData>;
2424
executeTool(command: CommandText, opts?: cp.ExecOptions): Promise<CliExitData>;
25-
spawn(cmd: string, params: string[], opts: cp.SpawnOptions): cp.ChildProcess;
2625
spawnTool(cmd: CommandText, opts: cp.SpawnOptions): Promise<cp.ChildProcess>;
2726
executeInTerminal(cmd: CommandText, cwd?: string, terminalName?: string, addEnv?: {[key : string]: string}): void;
2827
}
@@ -157,10 +156,6 @@ export class CliChannel implements Cli {
157156
await OpenShiftTerminalManager.getInstance().createTerminal(command, name, cwd, merged);
158157
}
159158

160-
spawn(cmd: string, params: string[], opts: cp.SpawnOptions = {cwd: undefined, env: process.env}): cp.ChildProcess {
161-
return cp.spawn(cmd, params, opts);
162-
}
163-
164159
async spawnTool(cmd: CommandText, opts: cp.SpawnOptions = {cwd: undefined, env: process.env}): Promise<cp.ChildProcess> {
165160
const toolLocation = await ToolsConfig.detect(cmd.command);
166161
const optWithTelemetryEnv = CliChannel.applyEnv(opts, CliChannel.createTelemetryEnv());

src/openshift/component.ts

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ import * as YAML from 'yaml';
1212
import { CliChannel } from '../cli';
1313
import { Command } from '../odo/command';
1414
import { ascDevfileFirst, ComponentTypeAdapter, ComponentTypeDescription } from '../odo/componentType';
15-
import { StarterProject, CommandProvider } from '../odo/componentTypeDescription';
15+
import { CommandProvider, StarterProject } from '../odo/componentTypeDescription';
1616
import { ComponentWorkspaceFolder } from '../odo/workspace';
1717
import * as odo3 from '../odo3';
1818
import sendTelemetry, { NewComponentCommandProps } from '../telemetry';
@@ -342,7 +342,7 @@ export class Component extends OpenShiftItem {
342342
const componentState = Component.componentStates.get(component.contextPath)
343343
if (componentState) {
344344
componentState.devTerminal.focusTerminal();
345-
componentState.devTerminal.sendText('\u0003');
345+
componentState.devTerminal.kill();
346346
}
347347
return;
348348
}
@@ -835,10 +835,11 @@ export class Component extends OpenShiftItem {
835835
if (Component.isUsingWebviewEditor()) {
836836
DescribeViewLoader.loadView(`Component ${componentName}: Run '${componentCommand.id}' Command`, command, componentFolder);
837837
} else {
838-
void Component.odo.executeInTerminal(
838+
void OpenShiftTerminalManager.getInstance().createTerminal(
839839
command,
840+
`Component ${componentName}: Run '${componentCommand.id}' Command`,
840841
componentFolder.contextPath,
841-
`OpenShift: Component ${componentName}: Run '${componentCommand.id}' Command`);
842+
);
842843
}
843844
} else {
844845
void window.showErrorMessage(`No Command found in Component '${componentName}`);

0 commit comments

Comments
 (0)