mirror of
https://github.com/Eugeny/tabby.git
synced 2025-02-23 14:59:41 +08:00
Git-bash support (fixes #12)
This commit is contained in:
parent
165ab1cfbf
commit
77b55a003c
@ -16,7 +16,7 @@ export interface ResizeEvent {
|
||||
|
||||
export interface SessionOptions {
|
||||
name?: string
|
||||
command?: string
|
||||
command?: string|string[]
|
||||
args?: string[]
|
||||
cwd?: string
|
||||
env?: any
|
||||
|
@ -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<string>(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<string>(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'))
|
||||
|
@ -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,
|
||||
|
Loading…
Reference in New Issue
Block a user