Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(terminal): strip AppImage runtime env from spawned terminals #3108

Mergedleorivastech(GitHub profile, opens in a new tab)merged 4 commits intomain fromrefs/pull/3108/headmerged by juliusmarminge View on GitHub

Showing 2 changed files with 105 additions and 1 deletion.

x
0 of 2 viewed, 2 left
57 additions and 0 deletionsapps/server/src/terminal/Manager.test.tsModified
View file
@@ -1334,6 +1334,63 @@
+ it.effect("strips AppImage runtime env from terminal sessions", () =>
+ Effect.gen(function* () {
+ const appDir = "/tmp/.mount_T3Codeabc123";
+ const { manager, ptyAdapter } = yield* createManager(5, {
+ env: {
+ APPIMAGE: "/home/user/T3-Code.AppImage",
+ APPDIR: appDir,
+ ARGV0: "/home/user/T3-Code.AppImage",
+ OWD: "/home/user/project",
+ PATH: `${appDir}/usr/bin:${appDir}:/usr/local/bin:/usr/bin:/bin`,
+ LD_LIBRARY_PATH: `${appDir}/usr/lib:/home/user/.local/lib`,
+ TEST_TERMINAL_KEEP: "keep-me",
+ },
+ });
+ yield* manager.open(openInput());
+ const spawnInput = ptyAdapter.spawnInputs[0];
+ expect(spawnInput).toBeDefined();
+ if (!spawnInput) return;
+​
+ // AppImage runtime markers must never reach the PTY — tools inside the
+ // terminal otherwise resolve against the AppImage mount (e.g. PHP_BINARY
+ // reporting the AppImage path instead of the real binary).
+ expect(spawnInput.env.APPIMAGE).toBeUndefined();
+ expect(spawnInput.env.APPDIR).toBeUndefined();
+ expect(spawnInput.env.ARGV0).toBeUndefined();
+ expect(spawnInput.env.OWD).toBeUndefined();