From 51b2270157bf4df8306c761ba53ffb022200c057 Mon Sep 17 00:00:00 2001 From: Hanqiu Zhang Date: Mon, 11 May 2020 21:25:33 -0400 Subject: [PATCH] fix(plugins/plugin-bash-like): add back configurable shell --- plugins/plugin-bash-like/src/pty/server.ts | 8 ++++++-- plugins/plugin-client-default/config.d/proxy.json | 4 +++- 2 files changed, 9 insertions(+), 3 deletions(-) diff --git a/plugins/plugin-bash-like/src/pty/server.ts b/plugins/plugin-bash-like/src/pty/server.ts index 61a42367359..ada771a04b6 100755 --- a/plugins/plugin-bash-like/src/pty/server.ts +++ b/plugins/plugin-bash-like/src/pty/server.ts @@ -192,10 +192,14 @@ export const getLoginShell = (): Promise => { export async function getShellOpts(): Promise { const kuirc = (await import('./kuirc')).default const bashShellOpts = process.platform === 'win32' ? undefined : ['--rcfile', await kuirc, '-i', '-c', '--'] - const shellOpts = process.platform === 'win32' ? [] : bashShellOpts + const { shellExe: s, shellOpts: o } = await import('@kui-shell/client/config.d/proxy.json').catch(() => { + return { shellExe: '', shellOpts: [] } + }) + const shellExe = s || (process.platform === 'win32' ? 'powershell.exe' : '/bin/bash') + const shellOpts = o && Array.isArray(o) && o.length > 0 ? o : process.platform === 'win32' ? [] : bashShellOpts return { - shellExe: process.platform === 'win32' ? 'powershell.exe' : '/bin/bash', + shellExe, shellOpts } } diff --git a/plugins/plugin-client-default/config.d/proxy.json b/plugins/plugin-client-default/config.d/proxy.json index d8360f09e52..604ab716043 100644 --- a/plugins/plugin-client-default/config.d/proxy.json +++ b/plugins/plugin-client-default/config.d/proxy.json @@ -5,5 +5,7 @@ "needleOptions": { "rejectUnauthorized": false } - } + }, + "shellExe": "", + "shellOpts": [] }