Skip to content
Source
Sign inSign up
pingdotgg/t3code

fix(cli): keep --base-dir in the sudo command browser setup prints #23646

Mergedonly21mil(GitHub profile, opens in a new tab)merged 1 commit intomain fromrefs/pull/23646/headmerged by maria-rcks View on GitHub

Showing 3 changed files with 29 additions and 5 deletions.

x
0 of 3 viewed, 3 left
8 additions and 3 deletionsapps/server/src/cli/browser.tsModified
View file
@@ -117,16 +117,21 @@
const fs = yield* FileSystem.FileSystem;
const isRoot = (yield* HostProcess.UserId) === 0;
- const setupCommand = yield* resolveRootCliCommand(PreviewBrowserHost.SETUP_SUBCOMMAND);
- // Root, unless sudo came from another user, is likely the server's own account.
const env = yield* HostProcess.Environment;
+ const baseDirPath = yield* setupBaseDir(baseDir);
+ // sudo resets the environment, so a chosen home has to be on the command line.
+ const setupCommand = yield* resolveRootCliCommand(
+ PreviewBrowserHost.SETUP_SUBCOMMAND,
+ Option.isSome(baseDir) || env.T3CODE_HOME !== undefined ? ["--base-dir", baseDirPath] : [],
+ );
+ // Root, unless sudo came from another user, is likely the server's own account.
const rootWarning =
isRoot && (env.SUDO_USER ?? "root") === "root" && !PreviewBrowserHost.sandboxDisabled(env)
? new PreviewBrowserHost.PreviewBrowserRootError().message
: undefined;
​
const needsProfile = yield* PreviewBrowserHost.sandboxBlocked;
- const browser = yield* installedBrowser(yield* setupBaseDir(baseDir));
+ const browser = yield* installedBrowser(baseDirPath);
const missing = Option.isSome(browser)
? yield* PreviewBrowserHost.missingLibraries(browser.value)
: [];
19 additions and 1 deletionapps/server/src/cli/invocation.test.tsModified
View file
@@ -19,8 +19,9 @@