提交 c0c2b693 编写于 作者: E Eugene Pankov

autoselect tmux

上级 23dabca2
......@@ -48,7 +48,12 @@ import { hterm } from './hterm'
if (hostApp.platform === Platform.Windows) {
return null
} else {
return tmux
if (tmux.isAvailable()) {
tmux.init()
return tmux
} else {
return screen
}
}
},
deps: [HostAppService, ScreenPersistenceProvider, TMuxPersistenceProvider],
......
import { Injectable } from '@angular/core'
import { execFileSync } from 'child_process'
import * as AsyncLock from 'async-lock'
import { ConnectableObservable, Subject } from 'rxjs'
import * as childProcess from 'child_process'
......@@ -166,6 +167,18 @@ export class TMuxPersistenceProvider extends SessionPersistenceProvider {
constructor () {
super()
}
isAvailable (): boolean {
try {
execFileSync('tmux', ['-V'])
return true
} catch (_) {
return false
}
}
init () {
this.tmux = new TMux()
}
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册