Skip to content
This repository was archived by the owner on Jul 30, 2025. It is now read-only.

Commit 80f8690

Browse files
myan9starpit
authored andcommitted
fix: kui session is noop in electron mode
Fixed by initializing electron channel factory when getSessionForTab is called in electron mode Fixes #3330
1 parent 4214641 commit 80f8690

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

plugins/plugin-bash-like/src/pty/session.ts

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ import { setStatus, Status } from '@kui-shell/core/webapp/status'
2020
import { getPrompt, getCurrentProcessingBlock } from '@kui-shell/core/webapp/cli'
2121
import { Capabilities, Commands, Errors, i18n, Settings, UI } from '@kui-shell/core'
2222

23-
import { Channel } from './channel'
23+
import { Channel, InProcessChannel } from './channel'
2424
import { setOnline, setOffline } from './ui'
2525

2626
const strings = i18n('plugin-bash-like')
@@ -38,8 +38,16 @@ export function getChannelForTab(tab: UI.Tab): Channel {
3838
* Return the session for the given tab
3939
*
4040
*/
41-
export function getSessionForTab(tab: UI.Tab): Promise<Channel> {
42-
return tab['_kui_session'] as Promise<Channel>
41+
export async function getSessionForTab(tab: UI.Tab): Promise<Channel> {
42+
if (tab['_kui_session'] === undefined && Capabilities.inElectron()) {
43+
const channel = new InProcessChannel()
44+
await channel.init()
45+
tab['_kui_session'] = channel
46+
47+
return tab['_kui_session']
48+
} else {
49+
return tab['_kui_session'] as Promise<Channel>
50+
}
4351
}
4452

4553
/**

0 commit comments

Comments
 (0)