diff --git a/terminus-terminal/src/api.ts b/terminus-terminal/src/api.ts index 36163305..05435c53 100644 --- a/terminus-terminal/src/api.ts +++ b/terminus-terminal/src/api.ts @@ -16,7 +16,7 @@ export interface ResizeEvent { export interface SessionOptions { name?: string - command?: string + command?: string|string[] args?: string[] cwd?: string env?: any diff --git a/terminus-terminal/src/components/terminalSettingsTab.component.ts b/terminus-terminal/src/components/terminalSettingsTab.component.ts index 1427b071..4d996a9a 100644 --- a/terminus-terminal/src/components/terminalSettingsTab.component.ts +++ b/terminus-terminal/src/components/terminalSettingsTab.component.ts @@ -59,16 +59,20 @@ export class TerminalSettingsTabComponent { { name: 'CMD (stock)', command: 'cmd.exe' }, { name: 'PowerShell', command: 'powershell.exe' }, ] + + // Detect whether BoW is installed const wslPath = `${process.env.windir}\\system32\\bash.exe` if (await fs.exists(wslPath)) { this.shells.push({ name: 'Bash on Windows', command: wslPath }) } + // Detect Cygwin let cygwinPath = await new Promise(resolve => { let reg = new Registry({ hive: Registry.HKLM, key: '\\Software\\Cygwin\\setup' }) reg.get('rootdir', (err, item) => { if (err) { resolve(null) + return } resolve(item.value) }) @@ -76,6 +80,21 @@ export class TerminalSettingsTabComponent { if (cygwinPath) { this.shells.push({ name: 'Cygwin', command: path.join(cygwinPath, 'bin', 'bash.exe') }) } + + // Detect Git-Bash + let gitBashPath = await new Promise(resolve => { + let reg = new Registry({ hive: Registry.HKLM, key: '\\Software\\GitForWindows' }) + reg.get('InstallPath', (err, item) => { + if (err) { + resolve(null) + return + } + resolve(item.value) + }) + }) + if (gitBashPath) { + this.shells.push({ name: 'Git-Bash', command: path.join(gitBashPath, 'bin', 'bash.exe') }) + } } if (this.hostApp.platform === Platform.Linux || this.hostApp.platform === Platform.macOS) { this.shells = (await fs.readFile('/etc/shells', 'utf-8')) diff --git a/terminus-terminal/src/services/sessions.service.ts b/terminus-terminal/src/services/sessions.service.ts index 8441502f..f8d64cec 100644 --- a/terminus-terminal/src/services/sessions.service.ts +++ b/terminus-terminal/src/services/sessions.service.ts @@ -28,10 +28,6 @@ export class Session { ...options.env, TERM: 'xterm-256color', } - if (options.command.includes(' ')) { - options.args = ['-c', options.command] - options.command = 'sh' - } this.pty = nodePTY.spawn(options.command, options.args || [], { name: 'xterm-256color', cols: options.width || 80,