From 1cffaaae345afb398b3a09f0dcb0267208873232 Mon Sep 17 00:00:00 2001 From: "Antoine C." Date: Sun, 19 Jan 2025 16:36:46 +0000 Subject: [PATCH] feat: add support for Flatpak --- src/authResolver.ts | 7 ++++++- src/common/platform.ts | 1 + 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/src/authResolver.ts b/src/authResolver.ts index 8c31e19..a805788 100644 --- a/src/authResolver.ts +++ b/src/authResolver.ts @@ -15,7 +15,7 @@ import { untildify, exists as fileExists } from './common/files'; import { findRandomPort } from './common/ports'; import { disposeAll } from './common/disposable'; import { installCodeServer, ServerInstallError } from './serverSetup'; -import { isWindows } from './common/platform'; +import { isWindows, isFlatpak } from './common/platform'; import * as os from 'os'; const PASSWORD_RETRY_COUNT = 3; @@ -163,6 +163,11 @@ export class RemoteSSHResolver implements vscode.RemoteAuthorityResolver, vscode options = { shell: true, windowsHide: true, windowsVerbatimArguments: true }; } + if (isFlatpak) { + proxyArgs = ["--", "flatpak-spawn", "--host", "--env=TERM=xterm-256", proxyCommand, ...proxyArgs]; + proxyCommand = "/usr/bin/env"; + } + this.logger.trace(`Spawning ProxyCommand: ${proxyCommand} ${proxyArgs.join(' ')}`); const child = cp.spawn(proxyCommand, proxyArgs, options); diff --git a/src/common/platform.ts b/src/common/platform.ts index 1fe4e02..2b3c921 100644 --- a/src/common/platform.ts +++ b/src/common/platform.ts @@ -1,3 +1,4 @@ export const isWindows = process.platform === 'win32'; export const isMacintosh = process.platform === 'darwin'; export const isLinux = process.platform === 'linux'; +export const isFlatpak = !!process.env['FLATPAK_ID'];