From b3d071fff78b9178654481e04e01d93adc9bb652 Mon Sep 17 00:00:00 2001 From: "codegen-sh[bot]" <131295404+codegen-sh[bot]@users.noreply.github.com> Date: Thu, 21 Aug 2025 00:35:04 +0000 Subject: [PATCH 1/2] docs: clarify that setup commands run as root and repo location - Add information about setup commands running as root user - Specify that repositories are cloned to /workspace directory - Add example for running commands as non-root user (e.g., for Homebrew) Co-authored-by: Jay Hack --- docs/sandboxes/setup-commands.mdx | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/docs/sandboxes/setup-commands.mdx b/docs/sandboxes/setup-commands.mdx index bd0ede1f0..99b7e431a 100644 --- a/docs/sandboxes/setup-commands.mdx +++ b/docs/sandboxes/setup-commands.mdx @@ -31,6 +31,13 @@ To configure setup commands for a repository: Enter your desired setup commands in the provided text area, with one command per line. These commands will be executed in sequence within the sandbox environment. + + **Important Environment Details:** + - All setup commands run as the **root** user + - Your repository is cloned to the **/workspace** directory + - If you need to run commands as a non-root user, use `su -c "command"` (e.g., `su linuxbrew -c "brew install "`) + + For example, you might want to: - Switch to a specific Node.js version. @@ -67,6 +74,12 @@ npm ci npm run build ``` +```bash +# Running commands as a non-root user (e.g., for Homebrew) +su linuxbrew -c "brew install postgresql" +su linuxbrew -c "brew services start postgresql" +``` + ### Working with Different Python Versions The sandbox comes with Python 3.13 by default, but some packages may not yet be compatible with this version. Here are strategies for handling different Python versions: @@ -144,4 +157,3 @@ deactivate The environment variables listed in the "Env Variables" section are available during the execution of these setup commands. - From a56f76283289c2311dc24afa4a7fbefd30a05b3b Mon Sep 17 00:00:00 2001 From: "codegen-sh[bot]" <131295404+codegen-sh[bot]@users.noreply.github.com> Date: Thu, 21 Aug 2025 00:36:37 +0000 Subject: [PATCH 2/2] docs: clarify quote handling in su commands - Add details about properly escaping quotes when using su command - Include examples of both single-quote and escaped double-quote approaches Co-authored-by: Jay Hack --- docs/sandboxes/setup-commands.mdx | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/docs/sandboxes/setup-commands.mdx b/docs/sandboxes/setup-commands.mdx index 99b7e431a..5472702af 100644 --- a/docs/sandboxes/setup-commands.mdx +++ b/docs/sandboxes/setup-commands.mdx @@ -36,6 +36,7 @@ Enter your desired setup commands in the provided text area, with one command pe - All setup commands run as the **root** user - Your repository is cloned to the **/workspace** directory - If you need to run commands as a non-root user, use `su -c "command"` (e.g., `su linuxbrew -c "brew install "`) + - When using quotes inside the `su` command, make sure to escape them properly: `su linuxbrew -c 'brew install "package with spaces"'` or `su linuxbrew -c "brew install \"package with spaces\""` For example, you might want to: @@ -78,6 +79,12 @@ npm run build # Running commands as a non-root user (e.g., for Homebrew) su linuxbrew -c "brew install postgresql" su linuxbrew -c "brew services start postgresql" + +# Handling quotes in commands (using single quotes around the command) +su linuxbrew -c 'brew install "package with spaces"' + +# Alternative: escaping double quotes inside the command +su linuxbrew -c "brew install \"package with spaces\"" ``` ### Working with Different Python Versions