Skip to content

Commit 84247da

Browse files
committed
[WIP] fix bug preventing the terminal from working on Windows
The resolution was to wrap all program executions in a Windows command line shell. I chose `cmd.exe`, although I expect PowerShell would also have worked. Signed-off-by: David Thompson <davidethompson@me.com>
1 parent 64e3ea5 commit 84247da

File tree

2 files changed

+15
-3
lines changed

2 files changed

+15
-3
lines changed

src/openshift/component.ts

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,6 @@ export class Component extends OpenShiftItem {
335335
}
336336

337337
@vsCommand('openshift.component.exitDevMode')
338-
@clusterRequired()
339338
static exitDevMode(component: ComponentWorkspaceFolder): Promise<void> {
340339
const componentState = Component.componentStates.get(component.contextPath)
341340
if (componentState) {
@@ -346,7 +345,6 @@ export class Component extends OpenShiftItem {
346345
}
347346

348347
@vsCommand('openshift.component.forceExitDevMode')
349-
@clusterRequired()
350348
static forceExitDevMode(component: ComponentWorkspaceFolder): Promise<void> {
351349
const componentState = Component.componentStates.get(component.contextPath)
352350
if (componentState && componentState.devTerminal) {

src/webview/openshift-terminal/openShiftTerminal.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,21 @@ class OpenShiftTerminal {
147147
}
148148

149149
startPty() {
150-
this._pty = ptyInstance.spawn(this._file, this._args, this._options);
150+
if (platform() === 'win32') {
151+
const escapedArgs = Array.isArray(this._args)
152+
? this._args.join(' ')
153+
: this._args;
154+
this._pty = ptyInstance.spawn(
155+
'C:\\WINDOWS\\system32\\cmd.EXE',
156+
[
157+
'/c',
158+
`${this._file} ${escapedArgs}`,
159+
],
160+
this._options,
161+
);
162+
} else {
163+
this._pty = ptyInstance.spawn(this._file, this._args, this._options);
164+
}
151165
this._disposables.push(
152166
this._pty.onData((data) => {
153167
if (this._terminalRendering) {

0 commit comments

Comments
 (0)