mirror of
https://github.com/wu736139669/hapi.git
synced 2026-10-28 23:01:34 +00:00
Add Windows remote terminal support (#642)
This commit is contained in:
@@ -2,14 +2,29 @@ import { describe, expect, it } from 'vitest'
|
||||
import { isRemoteTerminalSupported, isWindowsHostOs } from './terminalSupport'
|
||||
|
||||
describe('terminal support helpers', () => {
|
||||
it('detects Windows session hosts as unsupported', () => {
|
||||
it('does not disable remote terminal only because the session host is Windows', () => {
|
||||
expect(isWindowsHostOs('win32')).toBe(true)
|
||||
expect(isRemoteTerminalSupported({ os: 'win32', path: '', host: '' })).toBe(false)
|
||||
expect(isRemoteTerminalSupported({ os: 'win32', path: '', host: '' })).toBe(true)
|
||||
})
|
||||
|
||||
it('keeps remote terminal enabled for non-Windows or unknown hosts', () => {
|
||||
it('keeps remote terminal enabled for non-Windows or unknown hosts by default', () => {
|
||||
expect(isWindowsHostOs('linux')).toBe(false)
|
||||
expect(isRemoteTerminalSupported({ os: 'linux', path: '', host: '' })).toBe(true)
|
||||
expect(isRemoteTerminalSupported(null)).toBe(true)
|
||||
})
|
||||
|
||||
it('respects explicit terminal capability metadata when present', () => {
|
||||
expect(isRemoteTerminalSupported({
|
||||
os: 'win32',
|
||||
path: '',
|
||||
host: '',
|
||||
capabilities: { terminal: false }
|
||||
})).toBe(false)
|
||||
expect(isRemoteTerminalSupported({
|
||||
os: 'win32',
|
||||
path: '',
|
||||
host: '',
|
||||
capabilities: { terminal: true }
|
||||
})).toBe(true)
|
||||
})
|
||||
})
|
||||
|
||||
@@ -5,5 +5,5 @@ export function isWindowsHostOs(os: string | null | undefined): boolean {
|
||||
}
|
||||
|
||||
export function isRemoteTerminalSupported(metadata: SessionMetadataSummary | null | undefined): boolean {
|
||||
return !isWindowsHostOs(metadata?.os)
|
||||
return metadata?.capabilities?.terminal ?? true
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user