mirror of
https://github.com/Eugeny/tabby.git
synced 2025-09-24 17:16:03 +00:00
fixed conpty detection (fixes #653)
This commit is contained in:
@@ -1,4 +1,3 @@
|
|||||||
import * as os from 'os'
|
|
||||||
import { Component } from '@angular/core'
|
import { Component } from '@angular/core'
|
||||||
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
import { NgbModal } from '@ng-bootstrap/ng-bootstrap'
|
||||||
import { Subscription } from 'rxjs'
|
import { Subscription } from 'rxjs'
|
||||||
@@ -6,7 +5,7 @@ import { ConfigService, ElectronService, HostAppService, Platform } from 'termin
|
|||||||
import { EditProfileModalComponent } from './editProfileModal.component'
|
import { EditProfileModalComponent } from './editProfileModal.component'
|
||||||
import { IShell, Profile } from '../api'
|
import { IShell, Profile } from '../api'
|
||||||
import { TerminalService } from '../services/terminal.service'
|
import { TerminalService } from '../services/terminal.service'
|
||||||
import { UACService } from '../services/uac.service'
|
import { WIN_BUILD_CONPTY_SUPPORTED, WIN_BUILD_CONPTY_STABLE, isWindowsBuild } from '../utils'
|
||||||
|
|
||||||
@Component({
|
@Component({
|
||||||
template: require('./shellSettingsTab.component.pug'),
|
template: require('./shellSettingsTab.component.pug'),
|
||||||
@@ -20,7 +19,6 @@ export class ShellSettingsTabComponent {
|
|||||||
private configSubscription: Subscription
|
private configSubscription: Subscription
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
uac: UACService,
|
|
||||||
public config: ConfigService,
|
public config: ConfigService,
|
||||||
public hostApp: HostAppService,
|
public hostApp: HostAppService,
|
||||||
private electron: ElectronService,
|
private electron: ElectronService,
|
||||||
@@ -32,10 +30,9 @@ export class ShellSettingsTabComponent {
|
|||||||
this.reload()
|
this.reload()
|
||||||
})
|
})
|
||||||
this.reload()
|
this.reload()
|
||||||
this.isConPTYAvailable = uac.isAvailable
|
|
||||||
this.isConPTYStable = hostApp.platform === Platform.Windows
|
this.isConPTYAvailable = isWindowsBuild(WIN_BUILD_CONPTY_SUPPORTED)
|
||||||
&& parseFloat(os.release()) >= 10
|
this.isConPTYStable = isWindowsBuild(WIN_BUILD_CONPTY_STABLE)
|
||||||
&& parseInt(os.release().split('.')[2]) >= 18309
|
|
||||||
}
|
}
|
||||||
|
|
||||||
async ngOnInit () {
|
async ngOnInit () {
|
||||||
|
@@ -7,6 +7,7 @@ import { Injectable } from '@angular/core'
|
|||||||
import { Logger, LogService, ConfigService } from 'terminus-core'
|
import { Logger, LogService, ConfigService } from 'terminus-core'
|
||||||
import { exec } from 'mz/child_process'
|
import { exec } from 'mz/child_process'
|
||||||
import { SessionOptions } from '../api'
|
import { SessionOptions } from '../api'
|
||||||
|
import { WIN_BUILD_CONPTY_SUPPORTED, isWindowsBuild } from '../utils'
|
||||||
|
|
||||||
let macOSNativeProcessList
|
let macOSNativeProcessList
|
||||||
try {
|
try {
|
||||||
@@ -118,7 +119,8 @@ export class Session extends BaseSession {
|
|||||||
rows: options.height || 30,
|
rows: options.height || 30,
|
||||||
cwd,
|
cwd,
|
||||||
env: env,
|
env: env,
|
||||||
experimentalUseConpty: this.config.store.terminal.useConPTY && 1,
|
// `1` instead of `true` forces ConPTY even if unstable
|
||||||
|
experimentalUseConpty: (isWindowsBuild(WIN_BUILD_CONPTY_SUPPORTED) && this.config.store.terminal.useConPTY) ? 1 : false,
|
||||||
})
|
})
|
||||||
|
|
||||||
this.guessedCWD = cwd
|
this.guessedCWD = cwd
|
||||||
|
@@ -1,20 +1,18 @@
|
|||||||
import * as path from 'path'
|
import * as path from 'path'
|
||||||
import * as os from 'os'
|
|
||||||
import { Injectable } from '@angular/core'
|
import { Injectable } from '@angular/core'
|
||||||
import { ElectronService, HostAppService, Platform } from 'terminus-core'
|
import { ElectronService } from 'terminus-core'
|
||||||
import { SessionOptions } from '../api'
|
import { SessionOptions } from '../api'
|
||||||
|
|
||||||
|
import { WIN_BUILD_CONPTY_SUPPORTED, isWindowsBuild } from '../utils'
|
||||||
|
|
||||||
@Injectable({ providedIn: 'root' })
|
@Injectable({ providedIn: 'root' })
|
||||||
export class UACService {
|
export class UACService {
|
||||||
isAvailable = false
|
isAvailable = false
|
||||||
|
|
||||||
constructor (
|
constructor (
|
||||||
hostApp: HostAppService,
|
|
||||||
private electron: ElectronService,
|
private electron: ElectronService,
|
||||||
) {
|
) {
|
||||||
this.isAvailable = hostApp.platform === Platform.Windows
|
this.isAvailable = isWindowsBuild(WIN_BUILD_CONPTY_SUPPORTED)
|
||||||
&& parseFloat(os.release()) >= 10
|
|
||||||
&& parseInt(os.release().split('.')[2]) >= 17692
|
|
||||||
}
|
}
|
||||||
|
|
||||||
patchSessionOptionsForUAC (sessionOptions: SessionOptions): SessionOptions {
|
patchSessionOptionsForUAC (sessionOptions: SessionOptions): SessionOptions {
|
||||||
|
8
terminus-terminal/src/utils.ts
Normal file
8
terminus-terminal/src/utils.ts
Normal file
@@ -0,0 +1,8 @@
|
|||||||
|
import * as os from 'os'
|
||||||
|
|
||||||
|
export const WIN_BUILD_CONPTY_SUPPORTED = 17692
|
||||||
|
export const WIN_BUILD_CONPTY_STABLE = 18309
|
||||||
|
|
||||||
|
export function isWindowsBuild (build: number): boolean {
|
||||||
|
return process.platform === 'win32' && parseFloat(os.release()) >= 10 && parseInt(os.release().split('.')[2]) >= build
|
||||||
|
}
|
Reference in New Issue
Block a user