Skip to content

Commit a4f82e9

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 0afea3e commit a4f82e9

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
@@ -338,7 +338,6 @@ export class Component extends OpenShiftItem {
338338
}
339339

340340
@vsCommand('openshift.component.exitDevMode')
341-
@clusterRequired()
342341
static exitDevMode(component: ComponentWorkspaceFolder): Promise<void> {
343342
const componentState = Component.componentStates.get(component.contextPath)
344343
if (componentState) {
@@ -349,7 +348,6 @@ export class Component extends OpenShiftItem {
349348
}
350349

351350
@vsCommand('openshift.component.forceExitDevMode')
352-
@clusterRequired()
353351
static forceExitDevMode(component: ComponentWorkspaceFolder): Promise<void> {
354352
const componentState = Component.componentStates.get(component.contextPath)
355353
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)