diff --git a/docs/sandboxes/setup-commands.mdx b/docs/sandboxes/setup-commands.mdx index bd0ede1f0..5472702af 100644 --- a/docs/sandboxes/setup-commands.mdx +++ b/docs/sandboxes/setup-commands.mdx @@ -31,6 +31,14 @@ 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 "`) + - 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: - Switch to a specific Node.js version. @@ -67,6 +75,18 @@ 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" + +# 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 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 +164,3 @@ deactivate The environment variables listed in the "Env Variables" section are available during the execution of these setup commands. -